[Telepathy-commits] [telepathy-glib/master] Don't cancel channel requests until status-changed(Disconnected) has been emitted

Will Thompson will.thompson at collabora.co.uk
Wed Sep 24 09:41:14 PDT 2008


This gives ChannelManagers a chance to clean up their pending requests
before we do it from under them.
---
 telepathy-glib/base-connection.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c
index ca0409a..f2b5430 100644
--- a/telepathy-glib/base-connection.c
+++ b/telepathy-glib/base-connection.c
@@ -1495,15 +1495,6 @@ tp_base_connection_close_all_channels (TpBaseConnection *self)
   /* trigger close_all on all channel factories */
   g_ptr_array_foreach (priv->channel_factories, (GFunc)
       tp_channel_factory_iface_close_all, NULL);
-
-  /* cancel all queued channel requests */
-  if (priv->channel_requests->len > 0)
-    {
-      g_ptr_array_foreach (priv->channel_requests, (GFunc)
-        channel_request_cancel, NULL);
-      g_ptr_array_remove_range (priv->channel_requests, 0,
-        priv->channel_requests->len);
-    }
 }
 
 /* D-Bus methods on Connection interface ----------------------------*/
@@ -2535,6 +2526,17 @@ tp_base_connection_change_status (TpBaseConnection *self,
           self->self_handle = 0;
         }
 
+      /* cancel all queued channel requests that weren't already cancelled by
+       * the channel managers.
+       */
+      if (priv->channel_requests->len > 0)
+        {
+          g_ptr_array_foreach (priv->channel_requests, (GFunc)
+            channel_request_cancel, NULL);
+          g_ptr_array_remove_range (priv->channel_requests, 0,
+            priv->channel_requests->len);
+        }
+
       if (prev_status != TP_INTERNAL_CONNECTION_STATUS_NEW)
         {
           if (klass->disconnected)
-- 
1.5.6.5



More information about the Telepathy-commits mailing list