From 54690e0d5592ab9f323fec0d23148b16afdc90d7 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Mon, 5 Dec 2022 19:54:32 +0200 Subject: [PATCH] kinit: tweak the processes termination Signed-off-by: Ivailo Monev --- kinit/klauncher_adaptor.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kinit/klauncher_adaptor.cpp b/kinit/klauncher_adaptor.cpp index 5777031a..1ec413b5 100644 --- a/kinit/klauncher_adaptor.cpp +++ b/kinit/klauncher_adaptor.cpp @@ -37,7 +37,12 @@ static const int s_eventstime = 250; static const int s_sleeptime = 50; +// NOTE: keep in sync with: +// kde-workspace/kwin/effects/startupfeedback/startupfeedback.cpp +// kde-workspace/kcontrol/launch/kcmlaunch.cpp static const qint64 s_servicetimeout = 10000; // 10sec +// klauncher is the last process to quit in a session so 5sec for each process is more than enough +static const qint64 s_processtimeout = 5000; // 5sec static inline bool isPIDAlive(const pid_t pid) { @@ -66,7 +71,11 @@ KLauncherAdaptor::~KLauncherAdaptor() QProcess* process = m_processes.takeLast(); disconnect(process, 0, this, 0); process->terminate(); - process->waitForFinished(); + if (!process->waitForFinished(s_processtimeout)) { + kWarning() << "process still running" << process->pid(); + // SIGKILL is non-ignorable + process->kill(); + } } }