[gdm] GdmServer: take a reference to self in child watch function



commit 09c1058f3574990f676b8cbf3bc8d719d759b6a3
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sun Aug 26 01:25:28 2012 +0200

    GdmServer: take a reference to self in child watch function
    
    The handlers for the "died" and "exited" signals on gdm server
    trigger finalization of the slave by calling gdm_slave_stop().
    
    This commit ensures these handlers hold a reference to the server
    object, so the server doesn't get prematurely finalized before
    the handler finishes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682571

 daemon/gdm-server.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gdm-server.c b/daemon/gdm-server.c
index e1e9c39..4cc5264 100644
--- a/daemon/gdm-server.c
+++ b/daemon/gdm-server.c
@@ -677,6 +677,8 @@ server_child_watch (GPid       pid,
                  : WIFSIGNALED (status) ? WTERMSIG (status)
                  : -1);
 
+        g_object_ref (server);
+
         if (WIFEXITED (status)) {
                 int code = WEXITSTATUS (status);
                 g_signal_emit (server, signals [EXITED], 0, code);
@@ -687,6 +689,8 @@ server_child_watch (GPid       pid,
 
         g_spawn_close_pid (server->priv->pid);
         server->priv->pid = -1;
+
+        g_object_unref (server);
 }
 
 static gboolean



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