[empathy] clear_chatrooms: prevent destroying the list twice
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] clear_chatrooms: prevent destroying the list twice
- Date: Wed, 25 May 2011 08:04:14 +0000 (UTC)
commit 826d5e5fe6079c3960688edb36d21b6bb7825ad3
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Fri Apr 29 10:10:28 2011 +0200
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.
libempathy/empathy-chatroom-manager.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/libempathy/empathy-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c
index 212c5d8..2be475b 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]