forked from qt-creator/qt-creator
Fix up QProcess::waitForFinished()
waitForFinish returns false if the process is no longer running at the time of the call. Handle that throughout the codebase. Change-Id: Ia7194095454e82efbd4eb88f2d55926bdd09e094 Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
@@ -280,7 +280,7 @@ void BuildDirManager::stopProcess()
|
||||
|
||||
if (m_cmakeProcess->state() == QProcess::Running) {
|
||||
m_cmakeProcess->terminate();
|
||||
if (!m_cmakeProcess->waitForFinished(500))
|
||||
if (!m_cmakeProcess->waitForFinished(500) && m_cmakeProcess->state() == QProcess::Running)
|
||||
m_cmakeProcess->kill();
|
||||
}
|
||||
|
||||
@@ -305,9 +305,10 @@ void BuildDirManager::cleanUpProcess()
|
||||
|
||||
if (m_cmakeProcess->state() == QProcess::Running) {
|
||||
m_cmakeProcess->terminate();
|
||||
if (!m_cmakeProcess->waitForFinished(500))
|
||||
if (!m_cmakeProcess->waitForFinished(500) && m_cmakeProcess->state() == QProcess::Running)
|
||||
m_cmakeProcess->kill();
|
||||
}
|
||||
m_cmakeProcess->waitForFinished();
|
||||
delete m_cmakeProcess;
|
||||
m_cmakeProcess = nullptr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user