summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2016-11-10 18:30:42 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2016-11-11 12:14:22 +0000
commitbb07c8d8b6b5b554f649b703a3428eb062902803 (patch)
treea0662ad4952d54d79240fe6b4a113f7ff8a8b2c4
parent3cb1b0636e5aceb3c884364bf2589d8754965b5f (diff)
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 <christian.kandeler@qt.io>
-rw-r--r--src/jomlib/targetexecutor.cpp11
-rw-r--r--src/jomlib/targetexecutor.h1
2 files changed, 12 insertions, 0 deletions
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();