telepathy-gabble: server-tls-manager: deal with modification of the GList while iterating it
Simon McVittie
smcv at kemper.freedesktop.org
Tue Sep 11 04:26:45 PDT 2012
Module: telepathy-gabble
Branch: master
Commit: f88ae541292e0ff4abd9214bef4c7b99a55dc4e9
URL: http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=f88ae541292e0ff4abd9214bef4c7b99a55dc4e9
Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date: Wed Jul 11 11:53:03 2012 +0100
server-tls-manager: deal with modification of the GList while iterating it
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
---
src/server-tls-manager.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/server-tls-manager.c b/src/server-tls-manager.c
index 8dd90fb..c28d2d4 100644
--- a/src/server-tls-manager.c
+++ b/src/server-tls-manager.c
@@ -122,8 +122,17 @@ close_all (GabbleServerTLSManager *self)
if (self->priv->channel != NULL)
tp_base_channel_close (TP_BASE_CHANNEL (self->priv->channel));
- for (l = self->priv->completed_channels; l != NULL; l = l->next)
- tp_base_channel_close (l->data);
+ l = self->priv->completed_channels;
+ while (l != NULL)
+ {
+ /* use a temporary variable as the ::closed callback will delete
+ * the link from the list. */
+ GList *next = l->next;
+
+ tp_base_channel_close (l->data);
+
+ l = next;
+ }
}
static void
More information about the telepathy-commits
mailing list