LauncherInterface: Wait for graceful finish of process launcher

Give process launcher a chance to finish its processes
gracefully before we finish process launcher's process in Creator.
Otherwise, when Creator's process reaper kills the process
launcher's process while the process launcher is still
reaping its processes, the process launcher may leave zombies.

Instantiate the ProcessReaper inside ProcessReaper::reap(),
otherwise its destructor won't run at all inside process launcher.

Reverts e45e16d904

Fixes: QTCREATORBUG-27118
Change-Id: I00290cda05538b5a7ecbeb08240d1e3772d43d62
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2022-03-14 22:12:21 +01:00
parent faadc86ece
commit 816746a06d
6 changed files with 16 additions and 47 deletions

View File

@@ -138,12 +138,11 @@ void LauncherInterfacePrivate::doStart()
void LauncherInterfacePrivate::doStop()
{
m_server->close();
if (!m_process)
return;
m_process->disconnect();
QTC_ASSERT(m_process, return);
m_socket->shutdown();
m_process->waitForFinished(3000);
ProcessReaper::reap(m_process);
m_process->waitForFinished(-1); // Let the process interface finish so that it finishes
// reaping any possible processes it has started.
delete m_process;
m_process = nullptr;
}