changeset 4721:91ef4fae4a49

[gaim-migrate @ 5033] plug a leak or two, and make removing buddies not blow up. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Wed, 12 Mar 2003 02:27:28 +0000
parents 06e8e5858121
children 534eaa4ead94
files src/buddy.c src/list.c
diffstat 2 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy.c	Wed Mar 12 01:34:25 2003 +0000
+++ b/src/buddy.c	Wed Mar 12 02:27:28 2003 +0000
@@ -192,8 +192,10 @@
 	gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
 	node = g_value_get_pointer(&val);
 
-	if (!GAIM_BLIST_NODE_IS_BUDDY(node))
+	if (!GAIM_BLIST_NODE_IS_BUDDY(node)) {
+		gtk_tree_path_free(path);
 		return FALSE;
+	}
 
 	menu = gtk_menu_new();
 
@@ -237,6 +239,7 @@
 	  * the event propoagates down and somehow gets interpreted as the start of a drag event. */
 	sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
 	gtk_tree_selection_select_path(sel, path);
+	gtk_tree_path_free(path);
 	return TRUE;
 #endif
 }
@@ -312,8 +315,10 @@
 						8, /* bits */
 						(void*)&node,
 						sizeof (node));
+
+		gtk_tree_path_free(sourcerow);
 	}
-		
+
 }
 
 static void gaim_gtk_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guint y,
@@ -326,6 +331,7 @@
 		memcpy(&b, sd->data, sizeof(b));
 		if(gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) {
 			/* if we're here, I think it means the drop is ok */
+			gtk_tree_path_free(path);
 		}
 	}
 }
@@ -872,6 +878,7 @@
 						     * we expand the group node */
 					GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &groupiter);
 					gtk_tree_view_expand_row(GTK_TREE_VIEW(gtkblist->treeview), path, TRUE);
+					gtk_tree_path_free(path);
 				}
 			}
 		}
--- a/src/list.c	Wed Mar 12 01:34:25 2003 +0000
+++ b/src/list.c	Wed Mar 12 02:27:28 2003 +0000
@@ -296,13 +296,21 @@
 {
 	struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops;
 
-	GaimBlistNode *node = (GaimBlistNode*)buddy;
-	
+	GaimBlistNode *gnode, *node = (GaimBlistNode*)buddy;
+	struct group *group;
+
+	gnode = node->parent;
+	group = (struct group *)gnode;
+
+	if(gnode->child == node)
+		gnode->child = node->next;
 	if (node->prev)
 		node->prev->next = node->next;
 	if (node->next)
 		node->next->prev = node->prev;
-	
+
+	group->members = g_slist_remove(group->members, buddy);
+
 	ops->remove(gaimbuddylist, node);
 	g_free(buddy->name);
 	g_free(buddy->alias);