[empathy] debug-window: don't disconnect the new debug msg signal once the proxy has been invalidated



commit 6e1756e9eafd1fb88c0e09fbb80a31185c6c13ff
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Nov 30 16:03:58 2009 +0000

    debug-window: don't disconnect the new debug msg signal once the proxy has been invalidated
    
    According to tp_proxy_signal_connection_disconnect's documentation it's not
    safe to disconnect a signal after its proxy has been invalidated (#603384).

 src/empathy-debug-window.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/empathy-debug-window.c b/src/empathy-debug-window.c
index 4c34e68..e411fcd 100644
--- a/src/empathy-debug-window.c
+++ b/src/empathy-debug-window.c
@@ -98,6 +98,7 @@ typedef struct
   TpProxy *proxy;
   TpProxySignalConnection *new_debug_message_signal;
   TpProxySignalConnection *name_owner_changed_signal;
+  gulong invalid_signal_id;
 
   /* Whether NewDebugMessage will be fired */
   gboolean paused;
@@ -402,6 +403,19 @@ debug_window_add_log_messages_from_cache (EmpathyDebugWindow *debug_window,
 }
 
 static void
+proxy_invalidated_cb (TpProxy *proxy,
+    guint domain,
+    gint code,
+    gchar *msg,
+    EmpathyDebugWindowPriv *self)
+{
+  EmpathyDebugWindowPriv *priv = GET_PRIV (self);
+
+  /* Proxy has been invalidated so we can't disconnect the signal any more */
+  priv->new_debug_message_signal = NULL;
+}
+
+static void
 debug_window_cm_chooser_changed_cb (GtkComboBox *cm_chooser,
     EmpathyDebugWindow *debug_window)
 {
@@ -466,7 +480,10 @@ debug_window_cm_chooser_changed_cb (GtkComboBox *cm_chooser,
     }
 
   if (priv->proxy != NULL)
-    g_object_unref (priv->proxy);
+    {
+      g_signal_handler_disconnect (priv->proxy, priv->invalid_signal_id);
+      g_object_unref (priv->proxy);
+    }
 
   priv->proxy = proxy;
 
@@ -475,6 +492,9 @@ debug_window_cm_chooser_changed_cb (GtkComboBox *cm_chooser,
   emp_cli_debug_call_get_messages (priv->proxy, -1,
       debug_window_get_messages_cb, debug_window, NULL, NULL);
 
+  priv->invalid_signal_id = g_signal_connect (proxy, "invalidated",
+      G_CALLBACK (proxy_invalidated_cb), debug_window);
+
   g_object_unref (dbus);
 }
 
@@ -1460,6 +1480,7 @@ debug_window_dispose (GObject *object)
   if (priv->proxy != NULL)
     {
       debug_window_set_enabled (EMPATHY_DEBUG_WINDOW (object), FALSE);
+      g_signal_handler_disconnect (priv->proxy, priv->invalid_signal_id);
       g_object_unref (priv->proxy);
     }
 



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