changeset 10515:ef9b6ef0c858

[gaim-migrate @ 11816] plug that leak again, and fix why we couldn't plug it before. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Thu, 13 Jan 2005 19:47:25 +0000
parents 8f1316d77315
children d7ca3fa38e05
files src/gtkblist.c
diffstat 1 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkblist.c	Thu Jan 13 19:37:34 2005 +0000
+++ b/src/gtkblist.c	Thu Jan 13 19:47:25 2005 +0000
@@ -3642,9 +3642,10 @@
 	 * valgrind found several reasons why it's good. If this causes problems
 	 * comment it out again. Stu */
 	/* Of course it still causes problems - this breaks dragging buddies into
-	 * contacts, the dragged buddy mysteriously 'disappears'. Stu.
+	 * contacts, the dragged buddy mysteriously 'disappears'. Stu. */
+	/* I think it's fixed now. Stu. */
 	g_free(node->ui_data);
-	node->ui_data = NULL; */
+	node->ui_data = NULL;
 }
 
 static gboolean do_selection_changed(GaimBlistNode *new_selection)
@@ -3684,7 +3685,7 @@
 	struct _gaim_gtk_blist_node *gtknode = node->ui_data;
 	GtkTreePath *newpath;
 
-	if(!gtknode || !iter)
+	if(!iter)
 		return FALSE;
 
 	if(node->parent && !get_iter_from_node(node->parent, &parent_iter))
@@ -3699,7 +3700,17 @@
 		*iter = sort_method_none(node, list, parent_iter, curptr);
 	}
 
-	gtk_tree_row_reference_free(gtknode->row);
+	if(gtknode != NULL) {
+		gtk_tree_row_reference_free(gtknode->row);
+	} else {
+		gaim_gtk_blist_new_node(node);
+		gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
+		/* If the node is a contact, and gtknode was NULL, it's because it was dragged.
+		 * It *must* have been expanded in order for it to be dragged. */
+		if(GAIM_BLIST_NODE_IS_CONTACT(node))
+			gtknode->contact_expanded = TRUE;
+	}
+
 	newpath = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel),
 			iter);
 	gtknode->row =
@@ -3859,7 +3870,6 @@
 	/* First things first, update the group */
 	gaim_gtk_blist_update_group(list, node->parent);
 
-	gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
 	contact = (GaimContact*)node;
 	buddy = gaim_contact_get_priority_buddy(contact);
 
@@ -3873,6 +3883,8 @@
 		if(!insert_node(list, node, &iter))
 			return;
 
+		gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
+
 		if(gtknode->contact_expanded) {
 			GdkPixbuf *status;
 			char *mark;