[Telepathy-commits] [telepathy-glib/master] NULLify proxies' dbus connection and daemon after emitting invalidated.

Will Thompson will.thompson at collabora.co.uk
Fri Dec 12 08:31:43 PST 2008


This fixes fd.o bug #18845: the handle ref cleanup code needs to use the
DBusGConnection in response to ::invalidated being emitted, but if the service
fell off the bus the DBusGConnection was destroyed before the signal was
emitted.
---
 telepathy-glib/proxy.c |   28 ++++++++++++----------------
 1 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/telepathy-glib/proxy.c b/telepathy-glib/proxy.c
index e4b8601..b4e9da5 100644
--- a/telepathy-glib/proxy.c
+++ b/telepathy-glib/proxy.c
@@ -412,6 +412,18 @@ tp_proxy_emit_invalidated (gpointer p)
    * to the proxies */
   tp_proxy_lose_interfaces (self);
 
+  if (self->dbus_daemon != NULL)
+    {
+      g_object_unref (self->dbus_daemon);
+      self->dbus_daemon = NULL;
+    }
+
+  if (self->dbus_connection != NULL)
+    {
+      dbus_g_connection_unref (self->dbus_connection);
+      self->dbus_connection = NULL;
+    }
+
   return FALSE;
 }
 
@@ -439,18 +451,6 @@ tp_proxy_invalidate (TpProxy *self, const GError *error)
 
       tp_proxy_emit_invalidated (self);
     }
-
-  if (self->dbus_daemon != NULL)
-    {
-      g_object_unref (self->dbus_daemon);
-      self->dbus_daemon = NULL;
-    }
-
-  if (self->dbus_connection != NULL)
-    {
-      dbus_g_connection_unref (self->dbus_connection);
-      self->dbus_connection = NULL;
-    }
 }
 
 static void
@@ -475,10 +475,6 @@ tp_proxy_iface_destroyed_cb (DBusGProxy *dgproxy,
       g_idle_add_full (G_PRIORITY_HIGH, tp_proxy_emit_invalidated,
           g_object_ref (self), g_object_unref);
     }
-
-  /* this won't re-emit 'invalidated' because we already set
-   * self->invalidated */
-  tp_proxy_invalidate (self, self->invalidated);
 }
 
 /**
-- 
1.5.6.5




More information about the Telepathy-commits mailing list