[Telepathy-commits] [telepathy-glib/master] BaseConnection: set self_handle to 0 as late as possible when disconnecting

Will Thompson will.thompson at collabora.co.uk
Tue Sep 23 10:10:27 PDT 2008


Previously, self_handle was set to zero before signalling
status-changed.  This meant that channel managers which use the
status-changed signal to close all their channels could not use the
self_handle field when doing so, unlike channel factories (on which
close_all was called before blanking the self-handle).
---
 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 3ffd906..6548110 100644
--- a/telepathy-glib/base-connection.c
+++ b/telepathy-glib/base-connection.c
@@ -2381,6 +2381,13 @@ 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);
 }
 
@@ -2498,13 +2505,6 @@ tp_base_connection_change_status (TpBaseConnection *self,
        * after we've started disconnecting
        */
       tp_base_connection_close_all_channels (self);
-
-      if (self->self_handle)
-        {
-          tp_handle_unref (priv->handles[TP_HANDLE_TYPE_CONTACT],
-              self->self_handle);
-          self->self_handle = 0;
-        }
     }
 
   DEBUG("emitting status-changed to %u, for reason %u", status, reason);
-- 
1.5.6.5




More information about the Telepathy-commits mailing list