[gdm] session: harden against server dbus outliving session object



commit 30c405116c1da9f74f9958093d964236e50fd5cb
Author: Ray Strode <rstrode redhat com>
Date:   Mon Jul 29 10:17:30 2013 -0400

    session: harden against server dbus outliving session object
    
    Right now we do:
    
    g_signal_connect (dbus_server, "...", callback, self);
    
    in a few places.  These signal connections should go away when the dbus
    server is unreffed in dispose, but to be on the safe side we should
    use g_signal_connect_object anyway.  (See for instance the leak
    fix in the previous commit).

 daemon/gdm-session.c |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)
---
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index cf332a6..d74bed6 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -1553,10 +1553,11 @@ setup_worker_server (GdmSession *self)
         g_debug ("GdmSession: Creating D-Bus server for worker for session");
 
         observer = g_dbus_auth_observer_new ();
-        g_signal_connect (observer,
-                          "authorize-authenticated-peer",
-                          G_CALLBACK (allow_worker_function),
-                          self);
+        g_signal_connect_object (observer,
+                                 "authorize-authenticated-peer",
+                                 G_CALLBACK (allow_worker_function),
+                                 self,
+                                 0);
 
         server = gdm_dbus_setup_private_server (observer, &error);
         g_object_unref (observer);
@@ -1567,10 +1568,11 @@ setup_worker_server (GdmSession *self)
                 return;
         }
 
-        g_signal_connect (server,
-                          "new-connection",
-                          G_CALLBACK (handle_connection_from_worker),
-                          self);
+        g_signal_connect_object (server,
+                                 "new-connection",
+                                 G_CALLBACK (handle_connection_from_worker),
+                                 self,
+                                 0);
         self->priv->worker_server = server;
 
         g_dbus_server_start (server);
@@ -1607,10 +1609,11 @@ setup_outside_server (GdmSession *self)
         g_debug ("GdmSession: Creating D-Bus server for greeters and such");
 
         observer = g_dbus_auth_observer_new ();
-        g_signal_connect (observer,
-                          "authorize-authenticated-peer",
-                          G_CALLBACK (allow_user_function),
-                          self);
+        g_signal_connect_object (observer,
+                                 "authorize-authenticated-peer",
+                                 G_CALLBACK (allow_user_function),
+                                 self,
+                                 0);
 
         server = gdm_dbus_setup_private_server (observer, &error);
         g_object_unref (observer);
@@ -1621,10 +1624,11 @@ setup_outside_server (GdmSession *self)
                 return;
         }
 
-        g_signal_connect (server,
-                          "new-connection",
-                          G_CALLBACK (handle_connection_from_outside),
-                          self);
+        g_signal_connect_object (server,
+                                 "new-connection",
+                                 G_CALLBACK (handle_connection_from_outside),
+                                 self,
+                                 0);
         self->priv->outside_server = server;
 
         g_dbus_server_start (server);


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