[empathy] Break after deleting current item in chatroom list



commit 279a93cbc25ade081510d94c20777e16527cf475
Author: Will Thompson <will thompson collabora co uk>
Date:   Mon Jun 8 22:39:56 2009 +0100

    Break after deleting current item in chatroom list
    
    When I signed off, Empathy exploded. l was 0x33, which oddly enough was
    secretly not the address of a GList. :-) I think what happened is that
    empathy_chatroom_manager_remove() deleted the list node currently
    pointed to by l; then the loop advanced to l->next, which was now
    garbage.
    
    We don't need to keep iterating once we find the chatroom we were
    looking for, so break out of the loop.
---
 libempathy/empathy-chatroom-manager.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libempathy/empathy-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c
index ad1f8c6..4441667 100644
--- a/libempathy/empathy-chatroom-manager.c
+++ b/libempathy/empathy-chatroom-manager.c
@@ -662,13 +662,16 @@ chatroom_manager_chat_destroyed_cb (EmpathyTpChat *chat,
         continue;
 
       empathy_chatroom_set_tp_chat (chatroom, NULL);
+
       if (!empathy_chatroom_is_favorite (chatroom))
         {
           /* Remove the chatroom from the list, unless it's in the list of
            * favourites..
            * FIXME this policy should probably not be in libempathy */
-          empathy_chatroom_manager_remove (manager, chatroom);
+          chatroom_manager_remove_link (manager, l);
         }
+
+      break;
     }
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]