[gnome-session] main: disconnect shutdown_cb when manager is destroyed



commit 6b62168488398baab871f59a40c004abf4e75e09
Author: Ray Strode <rstrode redhat com>
Date:   Fri Nov 30 16:09:26 2012 -0500

    main: disconnect shutdown_cb when manager is destroyed
    
    shutdown_cb is supposed to be called when gnome-session is
    running and suddenly the bus is ripped away from it.  Unfortunately,
    it also gets run as part of the normal shutdown path, which it isn't
    designed for.
    
    This commit changes g_signal_connect_swapped to g_signal_connect_object
    to ensure the handler is disconnected when the manager object goes away,
    so the handler isn't called in the normal shutdown path.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688992

 gnome-session/main.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gnome-session/main.c b/gnome-session/main.c
index e074526..4208684 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -327,10 +327,11 @@ main (int argc, char **argv)
 
         manager = gsm_manager_new (client_store, failsafe);
 
-        g_signal_connect_swapped (bus_proxy,
-                                  "destroy",
-                                  G_CALLBACK (shutdown_cb),
-                                  manager);
+        g_signal_connect_object (bus_proxy,
+                                 "destroy",
+                                 G_CALLBACK (shutdown_cb),
+                                 manager,
+                                 G_CONNECT_SWAPPED);
 
         g_unix_signal_add (SIGTERM, term_or_int_signal_cb, manager);
         g_unix_signal_add (SIGINT, term_or_int_signal_cb, manager);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]