← Back to team overview

lightdm-gtk-greeter-team team mailing list archive

[Merge] lp:~lightdm-gtk-greeter-team/lightdm-gtk-greeter/lp-1445461-leave-instance into lp:lightdm-gtk-greeter

 

Andrew P. has proposed merging lp:~lightdm-gtk-greeter-team/lightdm-gtk-greeter/lp-1445461-leave-instance into lp:lightdm-gtk-greeter.

Requested reviews:
  LightDM Gtk+ Greeter Development Team (lightdm-gtk-greeter-team)
Related bugs:
  Bug #1445461 in LightDM GTK+ Greeter: "Every lock activates a new Virtual Terminal"
  https://bugs.launchpad.net/lightdm-gtk-greeter/+bug/1445461

For more details, see:
https://code.launchpad.net/~lightdm-gtk-greeter-team/lightdm-gtk-greeter/lp-1445461-leave-instance/+merge/258352

Greeter can hangs after getting SIGTERM with Gtk > 3.15.
Details:
https://bugs.launchpad.net/lightdm-gtk-greeter/+bug/1441356/comments/1

This patch adds new configure option for distributions with Gtk 3.16:
--enable-kill-on-sigterm

There is no need to use it with ubuntu now.
-- 
Your team LightDM Gtk+ Greeter Development Team is requested to review the proposed merge of lp:~lightdm-gtk-greeter-team/lightdm-gtk-greeter/lp-1445461-leave-instance into lp:lightdm-gtk-greeter.
=== modified file 'configure.ac'
--- configure.ac	2015-02-16 00:30:20 +0000
+++ configure.ac	2015-05-06 09:34:52 +0000
@@ -132,6 +132,19 @@
 ])
 
 dnl ###########################################################################
+
+AC_ARG_ENABLE([kill-on-sigterm],
+    AC_HELP_STRING([--enable-kill-on-sigterm], [Kill greeter instance on SIGTERM, see LP1445461])
+    AC_HELP_STRING([--disable-kill-on-sigterm], [Don't kill greeter on SIGTERM, see LP1445461']),
+            [], [enable_kill_on_sigterm=no])
+
+AS_IF([test "x$enable_kill_on_sigterm" = "xyes"],
+[
+    AC_DEFINE([KILL_ON_SIGTERM], [1], [Kill greeter in SIGTERM handler, see LP1445461])
+],
+[])
+
+dnl ###########################################################################
 dnl Internationalization
 dnl ###########################################################################
 

=== modified file 'src/lightdm-gtk-greeter.c'
--- src/lightdm-gtk-greeter.c	2015-03-27 05:29:45 +0000
+++ src/lightdm-gtk-greeter.c	2015-05-06 09:34:52 +0000
@@ -423,10 +423,27 @@
 static void
 sigterm_cb (gpointer user_data)
 {
-    g_slist_foreach (pids_to_close, (GFunc)close_pid, GINT_TO_POINTER (FALSE));
-    g_slist_free (pids_to_close);
-    pids_to_close = NULL;
-    gtk_main_quit ();
+    gboolean is_callback = GPOINTER_TO_INT (user_data);
+
+    if (is_callback)
+        g_debug ("SIGTERM received");
+
+    if (pids_to_close)
+    {
+        g_slist_foreach (pids_to_close, (GFunc)close_pid, GINT_TO_POINTER (FALSE));
+        g_slist_free (pids_to_close);
+        pids_to_close = NULL;
+    }
+
+    if (is_callback)
+    {
+        gtk_main_quit ();
+        #ifdef KILL_ON_SIGTERM
+        /* LP: #1445461 */
+        g_debug ("Killing greeter with exit()...");
+        exit (EXIT_SUCCESS);
+        #endif
+    }
 }
 
 /* Power window */
@@ -2572,7 +2589,7 @@
     bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
     textdomain (GETTEXT_PACKAGE);
 
-    g_unix_signal_add (SIGTERM, (GSourceFunc)sigterm_cb, NULL);
+    g_unix_signal_add (SIGTERM, (GSourceFunc)sigterm_cb, /* is_callback */ GINT_TO_POINTER (TRUE));
 
     config_init ();
 
@@ -3072,9 +3089,11 @@
 
     gtk_widget_show (GTK_WIDGET (screen_overlay));
 
+    g_debug ("Run Gtk loop...");
     gtk_main ();
+    g_debug ("Gtk loop exits");
 
-    g_slist_foreach (pids_to_close, (GFunc)close_pid, NULL);
+    sigterm_cb (/* is_callback */ GINT_TO_POINTER (FALSE));
 
     return EXIT_SUCCESS;
 }


Follow ups