diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-06-08 21:25:39 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-06-08 21:25:39 +0200 |
commit | 2e747f6997549ed7b1edbdb3e6b1eb6707827975 (patch) | |
tree | ac3965632a7470d10bdbc9324531d1d9c11f4f4d | |
parent | 49f36af4f04d9da32f7f870fcfa0644f8afc7e73 (diff) | |
download | arctica-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.
-rw-r--r-- | src/arctica-greeter.vala | 2 | ||||
-rw-r--r-- | src/settings-daemon.vala | 34 |
2 files changed, 34 insertions, 2 deletions
diff --git a/src/arctica-greeter.vala b/src/arctica-greeter.vala index 160bcd2..75d82df 100644 --- a/src/arctica-greeter.vala +++ b/src/arctica-greeter.vala @@ -794,6 +794,8 @@ public class ArcticaGreeter } } + greeter.settings_daemon.stop(); + if (nmapplet_pid != 0) { Posix.kill (nmapplet_pid, Posix.SIGTERM); 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")] |