diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp index ef92b911dc8..0b774c6c7a5 100644 --- a/src/plugins/autotest/testrunner.cpp +++ b/src/plugins/autotest/testrunner.cpp @@ -558,8 +558,9 @@ void TestRunner::debugTests() outputreader, &QObject::deleteLater); } - connect(this, &TestRunner::requestStopTestRun, runControl, - &ProjectExplorer::RunControl::initiateStop); + m_stopDebugConnect = connect(this, &TestRunner::requestStopTestRun, + runControl, &ProjectExplorer::RunControl::initiateStop); + connect(runControl, &ProjectExplorer::RunControl::stopped, this, &TestRunner::onFinished); ProjectExplorer::ProjectExplorerPlugin::startRunControl(runControl); } @@ -618,6 +619,7 @@ void TestRunner::onFinished() qDeleteAll(m_selectedTests); m_selectedTests.clear(); + disconnect(m_stopDebugConnect); disconnect(m_targetConnect); m_fakeFutureInterface = nullptr; m_executingTests = false; diff --git a/src/plugins/autotest/testrunner.h b/src/plugins/autotest/testrunner.h index 11fc9815d6f..ae4fc7c0d52 100644 --- a/src/plugins/autotest/testrunner.h +++ b/src/plugins/autotest/testrunner.h @@ -99,6 +99,8 @@ private: // temporarily used if building before running is necessary QMetaObject::Connection m_buildConnect; + // temporarily used when debugging + QMetaObject::Connection m_stopDebugConnect; // temporarily used for handling of switching the current target QMetaObject::Connection m_targetConnect; };