diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2012-07-11 11:53:03 +0100 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2012-07-11 14:45:59 +0100 |
commit | f88ae541292e0ff4abd9214bef4c7b99a55dc4e9 (patch) | |
tree | 9802c1bf21736bd818c15d288ef8c0d47d34d1a8 | |
parent | 8947be225e17d1cee96cf41586f495dcd35c6904 (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.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/server-tls-manager.c b/src/server-tls-manager.c index 8dd90fbeb..c28d2d4d2 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 |