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:
Jarek Kobus
2022-07-06 16:43:06 +02:00
parent 5d8e53038e
commit 78958d5740

View File

@@ -483,29 +483,26 @@ void TerminalImpl::killProcess()
void TerminalImpl::killStub()
{
if (!isRunning())
return;
#ifdef Q_OS_WIN
if (d->m_pid) {
TerminateProcess(d->m_pid->hProcess, (unsigned)-1);
WaitForSingleObject(d->m_pid->hProcess, INFINITE);
cleanupStub();
}
#else
sendCommand('s');
stubServerShutdown();
d->m_process.waitForFinished();
#endif
emitFinished(-1, QProcess::CrashExit);
}
void TerminalImpl::stopProcess()
{
killProcess();
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