AutoTest: Disconnect signal after being processed

When debugging a test the run control outlives the connection
and the signal can be triggered again and again which results
in warnings on the command line. Do not rely on run control
handling things for us, instead disconnect the signal after it
had been processed.

Change-Id: I704fd110bce3b387ee419a3f83bf904f2687a435
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2018-08-02 15:56:26 +02:00
parent 18617668a0
commit c1f78335e0
2 changed files with 6 additions and 2 deletions

View File

@@ -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;

View File

@@ -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;
};