From c1f78335e005b311ce3eac94ca48cc573f50a56d Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 2 Aug 2018 15:56:26 +0200 Subject: [PATCH] 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 --- src/plugins/autotest/testrunner.cpp | 6 ++++-- src/plugins/autotest/testrunner.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) 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; };