pidgin: f19814a9: Fix a crash (from the single instance pa...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun May 3 23:00:30 EDT 2009


-----------------------------------------------------------------
Revision: f19814a9bc18cc2b84bdfc83d02569128c4fd66f
Ancestor: 31ef531a4ba2ec1a28f7ea716791f9f9169b313b
Author: darkrain42 at pidgin.im
Date: 2009-05-04T02:54:55
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/f19814a9bc18cc2b84bdfc83d02569128c4fd66f

Modified files:
        libpurple/blist.c

ChangeLog: 

Fix a crash (from the single instance path) and leak of the node UI data.

-------------- next part --------------
============================================================
--- libpurple/blist.c	c19c1ab51d9428857b76795b79a8afea84b78320
+++ libpurple/blist.c	22936dc5c180a9eee59d5b09bea8dc9e8240872a
@@ -2720,8 +2720,10 @@ purple_blist_node_destroy(PurpleBlistNod
 static void
 purple_blist_node_destroy(PurpleBlistNode *node)
 {
+	PurpleBlistUiOps *ui_ops;
 	PurpleBlistNode *child, *next_child;
 
+	ui_ops = purple_blist_get_ui_ops();
 	child = node->child;
 	while (child) {
 		next_child = child->next;
@@ -2729,6 +2731,10 @@ purple_blist_node_destroy(PurpleBlistNod
 		child = next_child;
 	}
 
+	/* Allow the UI to free data */
+	if (ui_ops && ui_ops->remove)
+		ui_ops->remove(purplebuddylist, node);
+
 	if (PURPLE_BLIST_NODE_IS_BUDDY(node))
 		purple_buddy_destroy((PurpleBuddy*)node);
 	else if (PURPLE_BLIST_NODE_IS_CHAT(node))
@@ -3049,6 +3055,10 @@ purple_blist_uninit(void)
 {
 	PurpleBlistNode *node, *next_node;
 
+	/* This happens if we quit before purple_set_blist is called. */
+	if (purplebuddylist == NULL)
+		return;
+
 	if (save_timer != 0) {
 		purple_timeout_remove(save_timer);
 		save_timer = 0;


More information about the Commits mailing list