summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2017-09-12 12:19:55 +0200
committerHolger Freyther <holger+qt@freyther.de>2017-11-29 02:12:25 +0000
commitf73fdd97d4bf70b02aac4c0b680a51e632f732eb (patch)
treee4406a5b06d40b8518d4debd4872019782a11681
parent613fb8ce4d5120fc219babe961dbbc71fe5fcd0c (diff)
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 <paul.tvete@qt.io>
-rw-r--r--wayland/democompositor/processlauncher.cpp11
-rw-r--r--wayland/democompositor/processlauncher.h1
-rw-r--r--wayland/democompositor/qml/Screen.qml2
3 files changed, 13 insertions, 1 deletions
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);
}
}