Qmake: Prevent unresponsive processes from hanging Qt Creator

That is, processes run via qmake's system() function.
Fun fact disovered while implementing this: "Canceling" the loading of a
qmake project did nothing at all except making the progress bar red at
the end of the parsing procedure. Now at least we terminate the
currently running processes invoked by system(), so the parsing threads
can continue and eventually finish.

Task-number: QTCREATORBUG-24825
Task-number: QTCREATORBUG-25000
Task-number: QTCREATORBUG-25194
Change-Id: Ic92ef200d3a49bbdeff0429ae7038fe3f1935b38
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Christian Kandeler
2021-01-05 12:33:09 +01:00
parent 5b4e652b26
commit a30aa4421a
4 changed files with 44 additions and 2 deletions

View File

@@ -666,6 +666,18 @@ void QmakeBuildSystem::asyncUpdate()
Constants::PROFILE_EVALUATE);
m_asyncUpdateFutureInterface.reportStarted();
const auto watcher = new QFutureWatcher<void>(this);
connect(watcher, &QFutureWatcher<void>::canceled, this, [this, watcher] {
if (!m_qmakeGlobals)
return;
watcher->disconnect();
m_qmakeGlobals->killProcesses();
});
connect(watcher, &QFutureWatcher<void>::finished, this, [watcher] {
watcher->disconnect();
watcher->deleteLater();
});
watcher->setFuture(m_asyncUpdateFutureInterface.future());
const Kit *const k = kit();
QtSupport::BaseQtVersion *const qtVersion = QtSupport::QtKitAspect::qtVersion(k);