aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-04-29 16:10:28 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-25 15:22:42 +0800
commit826d5e5fe6079c3960688edb36d21b6bb7825ad3 (patch)
treeaaf9839b3d2960c54135d271be6b1de8c1f6eb19 /libempathy
parent5079e73c8edf3b460ed11edc02ffb2cb6b705eac (diff)
downloadgsoc2013-empathy-826d5e5fe6079c3960688edb36d21b6bb7825ad3.tar
gsoc2013-empathy-826d5e5fe6079c3960688edb36d21b6bb7825ad3.tar.gz
gsoc2013-empathy-826d5e5fe6079c3960688edb36d21b6bb7825ad3.tar.bz2
gsoc2013-empathy-826d5e5fe6079c3960688edb36d21b6bb7825ad3.tar.lz
gsoc2013-empathy-826d5e5fe6079c3960688edb36d21b6bb7825ad3.tar.xz
gsoc2013-empathy-826d5e5fe6079c3960688edb36d21b6bb7825ad3.tar.zst
gsoc2013-empathy-826d5e5fe6079c3960688edb36d21b6bb7825ad3.zip
clear_chatrooms: prevent destroying the list twice
Unreffing the chatroom may result in destroying the underlying EmpathyTpChat which will fire the invalidated signal and so make us re-call this function. We already set priv->chatrooms to NULL so we won't try to destroy twice the same objects.
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-chatroom-manager.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/libempathy/empathy-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c
index 212c5d8ef..2be475b3a 100644
--- a/libempathy/empathy-chatroom-manager.c
+++ b/libempathy/empathy-chatroom-manager.c
@@ -424,9 +424,17 @@ static void
clear_chatrooms (EmpathyChatroomManager *self)
{
EmpathyChatroomManagerPriv *priv = GET_PRIV (self);
- GList *l;
+ GList *l, *tmp;
+
+ tmp = priv->chatrooms;
- for (l = priv->chatrooms; l != NULL; l = g_list_next (l))
+ /* Unreffing the chatroom may result in destroying the underlying
+ * EmpathyTpChat which will fire the invalidated signal and so make us
+ * re-call this function. We already set priv->chatrooms to NULL so we won't
+ * try to destroy twice the same objects. */
+ priv->chatrooms = NULL;
+
+ for (l = tmp; l != NULL; l = g_list_next (l))
{
EmpathyChatroom *chatroom = l->data;
@@ -437,8 +445,7 @@ clear_chatrooms (EmpathyChatroomManager *self)
g_object_unref (chatroom);
}
- g_list_free (priv->chatrooms);
- priv->chatrooms = NULL;
+ g_list_free (tmp);
}
static void