summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGeneratorMocUic.cxx
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-03-22 14:27:39 (GMT)
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-03-25 10:43:14 (GMT)
commite7a760fe7d20b5c3da53e2daa415ac09865da78c (patch)
tree55aeb8186bec8b1abf9b07c832306dabed14ef47 /Source/cmQtAutoGeneratorMocUic.cxx
parent89abbdd8c8db5bf587373f2a00f6a816eddd8496 (diff)
downloadCMake-e7a760fe7d20b5c3da53e2daa415ac09865da78c.zip
CMake-e7a760fe7d20b5c3da53e2daa415ac09865da78c.tar.gz
CMake-e7a760fe7d20b5c3da53e2daa415ac09865da78c.tar.bz2
Autogen: Fix deadlock when uv_spawn() fails while trying to run moc
If by some chance the moc executable does not exist while running AUTOMOC, instead of showing an error, the CMake Autogen invocation hangs indefinitely. This happens because UVProcessFinished() is not called if the process does not launch correctly. Make sure to call UVProcessFinished() even if the process launch fails, and also report the error returned by libuv.
Diffstat (limited to 'Source/cmQtAutoGeneratorMocUic.cxx')
-rw-r--r--Source/cmQtAutoGeneratorMocUic.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx
index cb6f7ea..0982473 100644
--- a/Source/cmQtAutoGeneratorMocUic.cxx
+++ b/Source/cmQtAutoGeneratorMocUic.cxx
@@ -1107,13 +1107,17 @@ void cmQtAutoGeneratorMocUic::WorkerT::UVProcessStart(uv_async_t* handle)
wrk.Process_->start(handle->loop, [&wrk] { wrk.UVProcessFinished(); });
}
}
+
+ if (!wrk.Process_->IsStarted()) {
+ wrk.UVProcessFinished();
+ }
}
void cmQtAutoGeneratorMocUic::WorkerT::UVProcessFinished()
{
{
std::lock_guard<std::mutex> lock(ProcessMutex_);
- if (Process_ && Process_->IsFinished()) {
+ if (Process_ && (Process_->IsFinished() || !Process_->IsStarted())) {
Process_.reset();
}
}