gnome-session r5095 - in trunk: . gnome-session



Author: matthiasc
Date: Mon Sep 15 21:30:36 2008
New Revision: 5095
URL: http://svn.gnome.org/viewvc/gnome-session?rev=5095&view=rev

Log:
2008-09-15  Matthias Clasen  <mclasen redhat com>

        Bug 552255 â leaks IceConnection objects

        * gnome-session/gsm-xsmp-client.c (gsm_xsmp_client_disconnect):
        Need to call IceCloseConnection always; SmsCleanUp doesn't do it
        for us.
        (client_iochannel_watch): ref client around the ICE processing,
        since handling SM callbacks might otherwise cause it to be
        destroyed. Clear client->priv->ice_connection on a
        ConnectionClosed response to avoid a double free.



Modified:
   trunk/ChangeLog
   trunk/gnome-session/gsm-xsmp-client.c

Modified: trunk/gnome-session/gsm-xsmp-client.c
==============================================================================
--- trunk/gnome-session/gsm-xsmp-client.c	(original)
+++ trunk/gnome-session/gsm-xsmp-client.c	Mon Sep 15 21:30:36 2008
@@ -78,25 +78,37 @@
                         GIOCondition   condition,
                         GsmXSMPClient *client)
 {
+        gboolean keep_going;
 
+        g_object_ref (client);
         switch (IceProcessMessages (client->priv->ice_connection, NULL, NULL)) {
         case IceProcessMessagesSuccess:
-                return TRUE;
+                keep_going = TRUE;
+                break;
 
         case IceProcessMessagesIOError:
                 g_debug ("GsmXSMPClient: IceProcessMessagesIOError on '%s'", client->priv->description);
                 gsm_client_set_status (GSM_CLIENT (client), GSM_CLIENT_FAILED);
+                /* Emitting "disconnected" will eventually cause
+                 * IceCloseConnection() to be called.
+                 */
                 gsm_client_disconnected (GSM_CLIENT (client));
-                return FALSE;
+                keep_going = FALSE;
+                break;
 
         case IceProcessMessagesConnectionClosed:
                 g_debug ("GsmXSMPClient: IceProcessMessagesConnectionClosed on '%s'",
                          client->priv->description);
-                return FALSE;
+                client->priv->ice_connection = NULL;
+                keep_going = FALSE;
+                break;
 
         default:
                 g_assert_not_reached ();
         }
+        g_object_unref (client);
+
+        return keep_going;
 }
 
 /* Called if too much time passes between the initial connection and
@@ -621,7 +633,9 @@
 
         if (client->priv->conn != NULL) {
                 SmsCleanUp (client->priv->conn);
-        } else {
+        }
+
+        if (client->priv->ice_connection != NULL) {
                 IceCloseConnection (client->priv->ice_connection);
         }
 



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