From c392d3ee13ae54f37a3b7ae2c94cc63b17092f3d Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 8 Aug 2017 15:27:15 +0200 Subject: [PATCH] ProjectExplorer: Kill dependent RunWorkers if dependencies go away There is no point in e.g. keeping the QML profiler RunWorker going if the process has spontaneously stopped. Change-Id: Ifdae17231cb193fd220397fa0739a74871ceeab3 Reviewed-by: hjk --- src/plugins/projectexplorer/runconfiguration.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index e1563957d64..bf3d1346d14 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -961,6 +961,22 @@ void RunControlPrivate::onWorkerStopped(RunWorker *worker) return; } + for (RunWorker *dependent : worker->d->stopDependencies) { + switch (dependent->d->state) { + case RunWorkerState::Done: + case RunWorkerState::Failed: + break; + case RunWorkerState::Initialized: + dependent->d->state = RunWorkerState::Done; + break; + default: + debugMessage("Killing " + dependent->d->id + " as it depends on stopped " + workerId); + dependent->d->state = RunWorkerState::Stopping; + QTimer::singleShot(0, dependent, &RunWorker::initiateStop); + break; + } + } + debugMessage("Checking whether all stopped"); bool allDone = true; for (RunWorker *worker : m_workers) {