aboutsummaryrefslogtreecommitdiff
path: root/src/settings-daemon.vala
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-06-08 21:25:39 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-06-08 21:25:39 +0200
commit2e747f6997549ed7b1edbdb3e6b1eb6707827975 (patch)
treeac3965632a7470d10bdbc9324531d1d9c11f4f4d /src/settings-daemon.vala
parent49f36af4f04d9da32f7f870fcfa0644f8afc7e73 (diff)
downloadarctica-greeter-2e747f6997549ed7b1edbdb3e6b1eb6707827975.tar.gz
arctica-greeter-2e747f6997549ed7b1edbdb3e6b1eb6707827975.tar.bz2
arctica-greeter-2e747f6997549ed7b1edbdb3e6b1eb6707827975.zip
src/settings-daemon.vala: Make sure the SettingsDaemon subprocess gets killed when greeter exits.
Diffstat (limited to 'src/settings-daemon.vala')
-rw-r--r--src/settings-daemon.vala34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/settings-daemon.vala b/src/settings-daemon.vala
index 6b06df8..523fa53 100644
--- a/src/settings-daemon.vala
+++ b/src/settings-daemon.vala
@@ -19,6 +19,7 @@
public class SettingsDaemon : Object
{
+ public int sd_pid = 0;
private int logind_inhibit_fd = -1;
private ScreenSaverInterface screen_saver;
private SessionManagerInterface session_manager;
@@ -132,6 +133,11 @@ public class SettingsDaemon : Object
}
}
+ public void stop ()
+ {
+ stop_settings_daemon();
+ }
+
private void set_plugin_enabled (string schema_name, bool enabled)
{
var source = SettingsSchemaSource.get_default ();
@@ -153,13 +159,37 @@ public class SettingsDaemon : Object
try
{
- Process.spawn_command_line_async (Config.SD_BINARY);
+ string[] argv;
+
+ Shell.parse_argv (Config.SD_BINARY, out argv);
+ Process.spawn_async (null,
+ argv,
+ null,
+ SpawnFlags.SEARCH_PATH,
+ null,
+ out sd_pid);
}
- catch (SpawnError e)
+ catch (Error e)
{
debug ("Could not start %s: %s", Config.SD_BINARY, e.message);
}
}
+
+ private void stop_settings_daemon ()
+ {
+ if (sd_pid != 0)
+ {
+ Posix.kill (sd_pid, Posix.SIGKILL);
+ int status;
+ Posix.waitpid (sd_pid, out status, 0);
+ if (Process.if_exited (status))
+ debug ("SettingsDaemon exited with return value %d", Process.exit_status (status));
+ else
+ debug ("SettingsDaemon terminated with signal %d", Process.term_sig (status));
+ sd_pid = 0;
+ }
+ }
+
}
[DBus (name="org.gnome.ScreenSaver")]