[Telepathy-commits] [telepathy-glib/master] BaseConnection: set self_handle to 0 just after emitting status-changed(Disconnected)

Will Thompson will.thompson at collabora.co.uk
Wed Sep 24 03:10:00 PDT 2008


Zeroing it in finish_shutdown() broke connection managers that unreffed
the connection before calling that method, as base_connection_dispose
asserts that self_handle == 0 (because the handle factories complain if
there are outstanding refs when they are destroyed).

Zeroing it in base_connection_dispose broke Gabble, because
gabble_connection_dispose asserts that the self_handle is already 0.
This is fd.o #17751, as dispose is conceptually the right place to drop
the ref.
---
 telepathy-glib/base-connection.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c
index 6548110..ca0409a 100644
--- a/telepathy-glib/base-connection.c
+++ b/telepathy-glib/base-connection.c
@@ -2381,13 +2381,6 @@ void tp_base_connection_finish_shutdown (TpBaseConnection *self)
 
   g_ptr_array_free (contexts, TRUE);
 
-  if (self->self_handle != 0)
-    {
-      tp_handle_unref (self->priv->handles[TP_HANDLE_TYPE_CONTACT],
-          self->self_handle);
-      self->self_handle = 0;
-    }
-
   g_signal_emit (self, signals[SHUTDOWN_FINISHED], 0);
 }
 
@@ -2535,6 +2528,13 @@ tp_base_connection_change_status (TpBaseConnection *self,
       break;
 
     case TP_CONNECTION_STATUS_DISCONNECTED:
+      if (self->self_handle != 0)
+        {
+          tp_handle_unref (self->priv->handles[TP_HANDLE_TYPE_CONTACT],
+              self->self_handle);
+          self->self_handle = 0;
+        }
+
       if (prev_status != TP_INTERNAL_CONNECTION_STATUS_NEW)
         {
           if (klass->disconnected)
-- 
1.5.6.5



More information about the Telepathy-commits mailing list