summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew P. <pan.pav.7c5@gmail.com>2014-10-10 22:57:14 +0300
committerAndrew P. <pan.pav.7c5@gmail.com>2014-10-10 22:57:14 +0300
commit9f301c072ed510e40a300aa80e7a2e631883b141 (patch)
tree9c08ea72456fabde3e27377fd5ccb6ae28bd8044
parent43ed5d1e215b257d0d852bafa4e40056a198bdb6 (diff)
downloadlightdm-gtk-greeter-git-9f301c072ed510e40a300aa80e7a2e631883b141.tar.gz
Kill "indicator-services-start" before gtk_main_quit (LP: #1377743)
-rw-r--r--src/lightdm-gtk-greeter.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/src/lightdm-gtk-greeter.c b/src/lightdm-gtk-greeter.c
index 0b4187c..8ff7977 100644
--- a/src/lightdm-gtk-greeter.c
+++ b/src/lightdm-gtk-greeter.c
@@ -61,6 +61,10 @@ static GKeyFile *state;
static gchar *state_filename;
static void save_state_file (void);
+/* Terminating */
+static void sigterm_cb (GSList *pids_to_close); /* pids - list of <GPid*> */
+static void close_pid (GPid *pid);
+
/* Screen window */
static GtkOverlay *screen_overlay;
@@ -312,6 +316,26 @@ save_state_file (void)
}
}
+/* Terminating */
+
+static void
+sigterm_cb (GSList *pids_to_close)
+{
+ g_slist_foreach (pids_to_close, (GFunc)close_pid, NULL);
+ gtk_main_quit ();
+}
+
+static void
+close_pid (GPid *ppid)
+{
+ if (*ppid)
+ {
+ kill (*ppid, SIGTERM);
+ waitpid (*ppid, NULL, 0);
+ *ppid = 0;
+ }
+}
+
/* Power window */
static gboolean
@@ -2456,9 +2480,12 @@ main (int argc, char **argv)
GtkCssProvider *css_provider;
GError *error = NULL;
Display *display;
+ GSList *pids_to_close = NULL;
#ifdef START_INDICATOR_SERVICES
GPid indicator_pid = 0, spi_pid = 0;
+ pids_to_close = g_slist_prepend (pids_to_close, &indicator_pid);
+ pids_to_close = g_slist_prepend (pids_to_close, &spi_pid);
#endif
/* Prevent memory from being swapped out, as we are dealing with passwords */
@@ -2476,7 +2503,7 @@ main (int argc, char **argv)
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
- g_unix_signal_add (SIGTERM, (GSourceFunc)gtk_main_quit, NULL);
+ g_unix_signal_add (SIGTERM, (GSourceFunc)sigterm_cb, pids_to_close);
/* init gtk */
gtk_init (&argc, &argv);
@@ -2965,19 +2992,7 @@ main (int argc, char **argv)
gtk_main ();
-#ifdef START_INDICATOR_SERVICES
- if (indicator_pid)
- {
- kill (indicator_pid, SIGTERM);
- waitpid (indicator_pid, NULL, 0);
- }
-
- if (spi_pid)
- {
- kill (spi_pid, SIGTERM);
- waitpid (spi_pid, NULL, 0);
- }
-#endif
+ g_slist_foreach (pids_to_close, (GFunc)close_pid, NULL);
return EXIT_SUCCESS;
}