Menu

#152 Crash if start of engine fails (0.8)

closed-fixed
None
5
2012-05-22
2011-02-02
Jens Nissen
No

If an engine cannot be run, an error message appears, afterwards, chessx 0.8 crashes.
The crash can probably only be reproduced under Mac OS 10.
The reason for the crash is, that the destructor of Engine is called too early!
Let's take a look at Qt's code, I made two comments for clarification what happens:

bool QProcessPrivate::_q_startupNotification()
{
Q_Q(QProcess);
#if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::startupNotification()");
#endif

if (startupSocketNotifier)
startupSocketNotifier->setEnabled(false);
if (processStarted()) {
q->setProcessState(QProcess::Running);
emit q->started();
return true;
}

q->setProcessState(QProcess::NotRunning);
processError = QProcess::FailedToStart;
emit q->error(processError); // !!!!!!!!!!!!!!!!!!!!!! A receiver of this call calls the destructor of Engine !!!!!!!!!!!!
#ifdef Q_OS_UNIX
// make sure the process manager removes this entry
waitForDeadChild();
findExitCode(); // !!!!!!!!!!!!!!!!!!!! And this line here tries to use the Engine code - a crash follows !!!!!!!!!!!
#endif
cleanup();
return false;
}

So the desctruction of Engine should be left to Qt and not be called manually!!!!!!!

Discussion

  • Bruno Rizzuti

    Bruno Rizzuti - 2011-02-03
    • assigned_to: nobody --> mrudolf
     
  • Jens Nissen

    Jens Nissen - 2012-05-20
    • assigned_to: mrudolf --> hognose
     
  • Jens Nissen

    Jens Nissen - 2012-05-22
    • status: open --> closed-fixed
     

Log in to post a comment.