forked from qt-creator/qt-creator
ProjectExplorer: Don't use dying RunControl
RunControlPrivate "detaches" from it's parent in the dtor by disconnecting and setting q to nullptr, so we better check that. Task-number: QTCREATORBUG-31801 Change-Id: Ic6f1a8cc3aa0e232c2db753b3ddd294a380d4b39 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1002,7 +1002,7 @@ void RunControlPrivate::onWorkerStopped(RunWorker *worker)
|
|||||||
|
|
||||||
void RunControlPrivate::showError(const QString &msg)
|
void RunControlPrivate::showError(const QString &msg)
|
||||||
{
|
{
|
||||||
if (!msg.isEmpty())
|
if (q && !msg.isEmpty())
|
||||||
q->postMessage(msg + '\n', ErrorMessageFormat);
|
q->postMessage(msg + '\n', ErrorMessageFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1247,6 +1247,9 @@ void RunControlPrivate::startTaskTree()
|
|||||||
|
|
||||||
void RunControlPrivate::checkAutoDeleteAndEmitStopped()
|
void RunControlPrivate::checkAutoDeleteAndEmitStopped()
|
||||||
{
|
{
|
||||||
|
if (!q)
|
||||||
|
return;
|
||||||
|
|
||||||
if (autoDelete) {
|
if (autoDelete) {
|
||||||
debugMessage("All finished. Deleting myself");
|
debugMessage("All finished. Deleting myself");
|
||||||
q->deleteLater();
|
q->deleteLater();
|
||||||
@@ -1356,7 +1359,8 @@ void RunControlPrivate::setState(RunControlState newState)
|
|||||||
// Extra reporting.
|
// Extra reporting.
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case RunControlState::Running:
|
case RunControlState::Running:
|
||||||
emit q->started();
|
if (q)
|
||||||
|
emit q->started();
|
||||||
break;
|
break;
|
||||||
case RunControlState::Stopped:
|
case RunControlState::Stopped:
|
||||||
checkAutoDeleteAndEmitStopped();
|
checkAutoDeleteAndEmitStopped();
|
||||||
|
Reference in New Issue
Block a user