changeset 26899:d97a130da290

Fix a crash (from the single instance path) and leak of the node UI data.
author Paul Aurich <paul@darkrain42.org>
date Mon, 04 May 2009 02:54:55 +0000
parents bcc577785c2b
children 9cb95f21979d
files libpurple/blist.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/blist.c	Mon May 04 02:21:23 2009 +0000
+++ b/libpurple/blist.c	Mon May 04 02:54:55 2009 +0000
@@ -2720,8 +2720,10 @@
 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 @@
 		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 @@
 {
 	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;