From f73fdd97d4bf70b02aac4c0b680a51e632f732eb Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 12 Sep 2017 12:19:55 +0200 Subject: democompositor: Allow to stop running processes by AppEntry Kill all processes that were started with the same AppEntry. It is using SIGKILL to make sure that the process is going away and going away quickly. Change-Id: I4d2bf2cf7fb35c34636640562c04e4bd528bed63 Reviewed-by: Paul Olav Tvete --- wayland/democompositor/processlauncher.cpp | 11 +++++++++++ wayland/democompositor/processlauncher.h | 1 + wayland/democompositor/qml/Screen.qml | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/wayland/democompositor/processlauncher.cpp b/wayland/democompositor/processlauncher.cpp index bd78de6..6147f05 100644 --- a/wayland/democompositor/processlauncher.cpp +++ b/wayland/democompositor/processlauncher.cpp @@ -107,6 +107,17 @@ bool WaylandProcessLauncher::isRunning(const AppEntry& entry) const return false; } +void WaylandProcessLauncher::kill(const AppEntry& entry) +{ + for (auto state : m_appStates) { + if (state.appEntry.sourceFileName != entry.sourceFileName) + continue; + + qCDebug(procs) << "Killing process " << state.process->pid() << " for " << entry.sourceFileName; + state.process->kill(); + } +} + void WaylandProcessLauncher::launch(const AppEntry &entry) { qCDebug(procs) << "Launching" << entry.executableName; diff --git a/wayland/democompositor/processlauncher.h b/wayland/democompositor/processlauncher.h index 3d30c07..9453368 100644 --- a/wayland/democompositor/processlauncher.h +++ b/wayland/democompositor/processlauncher.h @@ -86,6 +86,7 @@ public: Q_INVOKABLE QVariant appStateForPid(int pid) const; Q_INVOKABLE bool isRunning(const AppEntry& entry) const; + Q_INVOKABLE void kill(const AppEntry& entry); Q_SIGNALS: void appStarted(const AppState &appState); diff --git a/wayland/democompositor/qml/Screen.qml b/wayland/democompositor/qml/Screen.qml index ef3be4d..bea189b 100644 --- a/wayland/democompositor/qml/Screen.qml +++ b/wayland/democompositor/qml/Screen.qml @@ -91,7 +91,7 @@ WaylandOutput { id: apps onAppRemoved: { console.log("Application was removed: " + appEntry.appName); - launcher.stop(appEntry); + launcher.kill(appEntry); } } -- cgit v1.2.3