forked from qt-creator/qt-creator
TerminalProcess: Emit done() signal when stop() was called
When we call QtcProcess::stop(), the terminal process invokes stopProcess() method. However, if it doesn't emit done() then subsequent call to waitForFinished() will timeout with 30 s. This should fix the 30 seconds hang when debugging in terminal after pressing the red square button. Change-Id: Iea1f9ade85dc8a4414dc49d7c8a2cbe80f0b5756 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -483,29 +483,26 @@ void TerminalImpl::killProcess()
|
|||||||
|
|
||||||
void TerminalImpl::killStub()
|
void TerminalImpl::killStub()
|
||||||
{
|
{
|
||||||
|
if (!isRunning())
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
if (d->m_pid) {
|
|
||||||
TerminateProcess(d->m_pid->hProcess, (unsigned)-1);
|
TerminateProcess(d->m_pid->hProcess, (unsigned)-1);
|
||||||
WaitForSingleObject(d->m_pid->hProcess, INFINITE);
|
WaitForSingleObject(d->m_pid->hProcess, INFINITE);
|
||||||
cleanupStub();
|
cleanupStub();
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
sendCommand('s');
|
sendCommand('s');
|
||||||
stubServerShutdown();
|
stubServerShutdown();
|
||||||
|
d->m_process.waitForFinished();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
emitFinished(-1, QProcess::CrashExit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerminalImpl::stopProcess()
|
void TerminalImpl::stopProcess()
|
||||||
{
|
{
|
||||||
killProcess();
|
killProcess();
|
||||||
killStub();
|
killStub();
|
||||||
if (isRunning() && HostOsInfo::isAnyUnixHost()) {
|
|
||||||
d->m_process.terminate();
|
|
||||||
if (!d->m_process.waitForFinished(1000) && d->m_process.state() == QProcess::Running) {
|
|
||||||
d->m_process.kill();
|
|
||||||
d->m_process.waitForFinished();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TerminalImpl::isRunning() const
|
bool TerminalImpl::isRunning() const
|
||||||
|
Reference in New Issue
Block a user