Utils: Fix (Q)Process::interrupt

Since switching to a QProcess based implementation a different
code path is used to interrupt processes (QProcessImpl::sendControlSignal, instead of ProcessLauncherImpl::sendControlSignal).

The QProcess path still used outdated ProcessHelper::interruptProcess.

This patch removes the old path and replaces it with the correct
"ProcessHelper::interruptPid" for QProcess based processes.

This also fixes GdbEngine::interruptInferior2 which could not interrupt
processes during "Attach to running server"

Change-Id: I9e1917100acf89c07cab0d9c687e57bb555d9d83
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-01-15 14:08:05 +01:00
parent 2be9a658ad
commit 06658d981c
3 changed files with 1 additions and 9 deletions

View File

@@ -486,7 +486,7 @@ private:
m_process->kill(); m_process->kill();
break; break;
case ControlSignal::Interrupt: case ControlSignal::Interrupt:
ProcessHelper::interruptProcess(m_process); ProcessHelper::interruptPid(m_process->processId());
break; break;
case ControlSignal::KickOff: case ControlSignal::KickOff:
QTC_CHECK(false); QTC_CHECK(false);

View File

@@ -180,11 +180,4 @@ void ProcessHelper::interruptPid(qint64 pid)
#endif #endif
} }
void ProcessHelper::interruptProcess(QProcess *process)
{
ProcessHelper *helper = qobject_cast<ProcessHelper *>(process);
if (helper && helper->m_useCtrlCStub)
ProcessHelper::interruptPid(process->processId());
}
} // namespace Utils } // namespace Utils

View File

@@ -45,7 +45,6 @@ public:
void setUseCtrlCStub(bool enabled); // release only void setUseCtrlCStub(bool enabled); // release only
static void terminateProcess(QProcess *process); static void terminateProcess(QProcess *process);
static void interruptProcess(QProcess *process);
static void interruptPid(qint64 pid); static void interruptPid(qint64 pid);
private: private: