[telepathy-gabble/master] Separate destroying and removing _delayed_request_streams_ctx

Will Thompson will.thompson at collabora.co.uk
Wed Apr 15 09:51:08 PDT 2009


Disposing a media channel destroys all the delayed request streams. We
don't want that to modify the GPtrArray while we're iterating it.
---
 src/media-channel.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/media-channel.c b/src/media-channel.c
index 045d9f7..1f74554 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -1730,8 +1730,15 @@ destroy_request (struct _delayed_request_streams_ctx *ctx,
 
   g_array_free (ctx->types, TRUE);
   g_slice_free (struct _delayed_request_streams_ctx, ctx);
-  g_ptr_array_remove_fast (priv->delayed_request_streams, ctx);
+}
 
+static void
+destroy_and_remove_request (struct _delayed_request_streams_ctx *ctx)
+{
+  GabbleMediaChannelPrivate *priv = ctx->chan->priv;
+
+  destroy_request (ctx, NULL);
+  g_ptr_array_remove_fast (priv->delayed_request_streams, ctx);
 }
 
 static void media_channel_request_streams (GabbleMediaChannel *self,
@@ -1749,7 +1756,7 @@ repeat_request (struct _delayed_request_streams_ctx *ctx)
 
   ctx->timeout_id = 0;
   ctx->context = NULL;
-  destroy_request (ctx, NULL);
+  destroy_and_remove_request (ctx);
   return FALSE;
 }
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list