From bb07c8d8b6b5b554f649b703a3428eb062902803 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 10 Nov 2016 18:30:42 +0100 Subject: Gracefully release job client in error case When aborting the make process, because a target failed or such, it could happen that the job client was still acquiring a token from the job server. The user saw the disturbing message "JobClient destroyed while still acquiring". Wait in this case until the acquisition is done and release the job client afterwards. Task-number: QTCREATORBUG-17182 Change-Id: I4a0c256d365a23887560d511b0f157a9f36a0df2 Reviewed-by: Christian Kandeler --- src/jomlib/targetexecutor.cpp | 11 +++++++++++ src/jomlib/targetexecutor.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/jomlib/targetexecutor.cpp b/src/jomlib/targetexecutor.cpp index f765f2a..0f20d62 100644 --- a/src/jomlib/targetexecutor.cpp +++ b/src/jomlib/targetexecutor.cpp @@ -177,6 +177,16 @@ void TargetExecutor::waitForProcesses() process->waitForFinished(); } +void TargetExecutor::waitForJobClient() +{ + if (!m_jobClient->isAcquiring()) + return; + QEventLoop loop; + connect(m_jobClient, &JobClient::acquired, &loop, &QEventLoop::quit); + loop.exec(); + m_jobClient->release(); +} + void TargetExecutor::finishBuild(int exitCode) { if (exitCode == 0 @@ -234,6 +244,7 @@ void TargetExecutor::onChildFinished(CommandExecutor* executor, bool commandFail m_depgraph->clear(); m_pendingTargets.clear(); waitForProcesses(); + waitForJobClient(); finishBuild(2); } diff --git a/src/jomlib/targetexecutor.h b/src/jomlib/targetexecutor.h index f1a5d32..3379251 100644 --- a/src/jomlib/targetexecutor.h +++ b/src/jomlib/targetexecutor.h @@ -61,6 +61,7 @@ private slots: private: int numberOfRunningProcesses() const; void waitForProcesses(); + void waitForJobClient(); void finishBuild(int exitCode); void findNextTarget(); -- cgit v1.2.3