From 05ca3de5f59ce29621d726399e8df3d61e0aa856 Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Fri, 13 Feb 2026 12:52:40 +0100 Subject: [PATCH] runner: shutdown spawned runnerd QProcess reliably --- src/runnermanagerclient.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/runnermanagerclient.cpp b/src/runnermanagerclient.cpp index 1fca445..83ca7ee 100644 --- a/src/runnermanagerclient.cpp +++ b/src/runnermanagerclient.cpp @@ -152,15 +152,23 @@ void RunnerManagerClient::shutdownSpawnedRunnerDaemon() return; } - if (m_runnerdProcess->state() == QProcess::NotRunning) { + QProcess *p = m_runnerdProcess; + const auto state = p->state(); + if (state == QProcess::NotRunning) { return; } - m_runnerdProcess->terminate(); - if (!m_runnerdProcess->waitForFinished(1000)) { - m_runnerdProcess->kill(); - m_runnerdProcess->waitForFinished(1000); + // Avoid our finished() handler nulling the pointer while we're shutting down. + p->disconnect(this); + + p->terminate(); + if (!p->waitForFinished(3000)) { + p->kill(); + p->waitForFinished(3000); } + + p->deleteLater(); + m_runnerdProcess = nullptr; } void RunnerManagerClient::ensureRunnerDaemon()