summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2012-07-11 11:53:03 +0100
committerJonny Lamb <jonny.lamb@collabora.co.uk>2012-07-11 11:53:03 +0100
commit5de7189fa93918cc1dda3bfdf8d5833b63e43020 (patch)
treea12769b22ffa5719779d7d2b39dd0d2fbfd2a6c1
parentc04d52520e405649a2878902a0c825558b5a91ac (diff)
server-tls-manager: deal with modification of the GList while iterating it
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--src/server-tls-manager.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/server-tls-manager.c b/src/server-tls-manager.c
index 87969cc81..4e961cdde 100644
--- a/src/server-tls-manager.c
+++ b/src/server-tls-manager.c
@@ -123,8 +123,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