]> git.0d.be Git - empathy.git/commitdiff
debug-window: fix leak on all TpDebugClient
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 3 Feb 2014 17:29:41 +0000 (18:29 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 5 Feb 2014 12:54:06 +0000 (13:54 +0100)
The store keeps its own ref and the client is reffed while the async call so
we can unref it right away.

https://bugzilla.gnome.org/show_bug.cgi?id=692793

src/empathy-debug-window.c

index 0fbf9f6d0e200b51dffd80793e1fd63807abb674..39d9f3eec358742df70d2c445f655ce22225ee51 100644 (file)
@@ -392,9 +392,6 @@ debug_window_get_messages_cb (GObject *object,
        * selected service is unable to fetch debug messages */
       if (!tp_strdiff (active_service_name, proxy_service_name))
         debug_window_set_toolbar_sensitivity (self, FALSE);
        * selected service is unable to fetch debug messages */
       if (!tp_strdiff (active_service_name, proxy_service_name))
         debug_window_set_toolbar_sensitivity (self, FALSE);
-
-      /* We created the proxy for GetMessages call. Now destroy it. */
-      tp_clear_object (&debug);
       return;
     }
 
       return;
     }
 
@@ -415,6 +412,8 @@ debug_window_get_messages_cb (GObject *object,
       DEBUG ("Proxy for service: %s was successful in fetching debug"
           " messages. Saving it.", proxy_service_name);
 
       DEBUG ("Proxy for service: %s was successful in fetching debug"
           " messages. Saving it.", proxy_service_name);
 
+      /* The store will take its own ref on the proxy preventing it to be
+       * destroyed when leaving this callback. */
       gtk_list_store_set (self->priv->service_store, &iter,
           COL_PROXY, debug,
           -1);
       gtk_list_store_set (self->priv->service_store, &iter,
           COL_PROXY, debug,
           -1);
@@ -499,6 +498,8 @@ create_proxy_to_get_messages (EmpathyDebugWindow *self,
   tp_debug_client_get_messages_async (TP_DEBUG_CLIENT (new_proxy),
       debug_window_get_messages_cb, self);
 
   tp_debug_client_get_messages_async (TP_DEBUG_CLIENT (new_proxy),
       debug_window_get_messages_cb, self);
 
+  g_object_unref (new_proxy);
+
 finally:
   g_free (name);
   tp_clear_object (&stored_proxy);
 finally:
   g_free (name);
   tp_clear_object (&stored_proxy);