Skip to content

Commit

Permalink
Bugfix: Engine crash kills ChessX
Browse files Browse the repository at this point in the history
  • Loading branch information
Isarhamster committed Jan 17, 2025
1 parent d44740e commit 5ba632b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
17 changes: 15 additions & 2 deletions src/database/enginex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,23 @@ void EngineX::pollProcess()
}
}

void EngineX::removeProcess()
{
disconnect(m_process, SIGNAL(started()));
#if QT_VERSION < 0x060000
disconnect(m_process, SIGNAL(error(QProcess::ProcessError)));
#else
disconnect(m_process, SIGNAL(errorOccurred(QProcess::ProcessError)));
#endif
disconnect(m_process, SIGNAL(readyReadStandardOutput()));
disconnect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)));
m_process = nullptr;
}

void EngineX::processError(QProcess::ProcessError errMsg)
{
setActive(false);
m_process = nullptr;
removeProcess();
emit error(errMsg);
}

Expand Down Expand Up @@ -329,6 +342,6 @@ void EngineX::setAllowEngineOutput(bool allow)
void EngineX::processExited()
{
setActive(false);
m_process = nullptr;
removeProcess();
emit deactivated();
}
2 changes: 2 additions & 0 deletions src/database/enginex.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class EngineX : public QObject
/** Virtual destructor */
virtual ~EngineX();

void removeProcess();

/** Launch and initialize engine, fire activated() signal when done*/
void activate();

Expand Down
1 change: 0 additions & 1 deletion src/gui/analysiswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ void AnalysisWidget::engineError(QProcess::ProcessError e)
MessageDialog::warning(tr("There was an error (%1) running engine <b>%2</b>.")
.arg(e)
.arg(ui.engineList->currentText()));
stopEngine();
}

void AnalysisWidget::engineDeactivated()
Expand Down

0 comments on commit 5ba632b

Please sign in to comment.