im.pidgin.pidgin: 03251b6e4e7a7bf736ba0023dfe31a49e89d0f42

datallah at pidgin.im datallah at pidgin.im
Wed Oct 10 16:35:44 EDT 2007


-----------------------------------------------------------------
Revision: 03251b6e4e7a7bf736ba0023dfe31a49e89d0f42
Ancestor: 1e697229b1c9a564fa1e509cc9a4a83da6e664df
Author: datallah at pidgin.im
Date: 2007-10-10T04:11:52
Branch: im.pidgin.pidgin

Modified files:
        pidgin/gtkblist.c pidgin/gtklog.c

ChangeLog: 

Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).

-------------- next part --------------
============================================================
--- pidgin/gtkblist.c	08888ea5655779f2d8b848a85989ae6a46e18ab8
+++ pidgin/gtkblist.c	9ae65b6cdd85c1c326871cd6a7b898e5f318c188
@@ -5300,7 +5300,7 @@ static void buddy_node(PurpleBuddy *budd
 static void buddy_node(PurpleBuddy *buddy, GtkTreeIter *iter, PurpleBlistNode *node)
 {
 	PurplePresence *presence;
-	GdkPixbuf *status, *avatar, *emblem;
+	GdkPixbuf *status, *avatar, *emblem, *prpl_icon;
 	char *mark;
 	char *idle = NULL;
 	gboolean expanded = ((struct _pidgin_blist_node *)(node->parent->ui_data))->contact_expanded;
@@ -5310,7 +5310,7 @@ static void buddy_node(PurpleBuddy *budd
 
 	if (editing_blist)
 		return;
-	
+
 	status = pidgin_blist_get_status_icon((PurpleBlistNode*)buddy,
 						PIDGIN_STATUS_ICON_SMALL);
 
@@ -5357,6 +5357,8 @@ static void buddy_node(PurpleBuddy *budd
 		}
 	}
 
+	prpl_icon = pidgin_create_prpl_icon(buddy->account, PIDGIN_PRPL_ICON_SMALL);
+
 	gtk_tree_store_set(gtkblist->treemodel, iter,
 			   STATUS_ICON_COLUMN, status,
 			   STATUS_ICON_VISIBLE_COLUMN, TRUE,
@@ -5367,7 +5369,7 @@ static void buddy_node(PurpleBuddy *budd
 			   BUDDY_ICON_VISIBLE_COLUMN, biglist,
 			   EMBLEM_COLUMN, emblem,
 			   EMBLEM_VISIBLE_COLUMN, (emblem != NULL),
-			   PROTOCOL_ICON_COLUMN, pidgin_create_prpl_icon(buddy->account, PIDGIN_PRPL_ICON_SMALL),
+			   PROTOCOL_ICON_COLUMN, prpl_icon,
 			   PROTOCOL_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"),
 			   BGCOLOR_COLUMN, NULL,
 			   CONTACT_EXPANDER_COLUMN, NULL,
@@ -5383,6 +5385,8 @@ static void buddy_node(PurpleBuddy *budd
 		g_object_unref(status);
 	if(avatar)
 		g_object_unref(avatar);
+	if(prpl_icon)
+		g_object_unref(prpl_icon);
 }
 
 /* This is a variation on the original gtk_blist_update_contact. Here we
@@ -5503,9 +5507,7 @@ static void pidgin_blist_update_chat(Pur
 
 	if(purple_account_is_connected(chat->account)) {
 		GtkTreeIter iter;
-		GdkPixbuf *status;
-		GdkPixbuf *avatar;
-		GdkPixbuf *emblem;
+		GdkPixbuf *status, *avatar, *emblem, *prpl_icon;
 		char *mark;
 		gboolean showicons = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons");
 		PidginBlistNode *ui;
@@ -5536,6 +5538,8 @@ static void pidgin_blist_update_chat(Pur
 			mark = bold;
 		}
 
+		prpl_icon = pidgin_create_prpl_icon(chat->account, PIDGIN_PRPL_ICON_SMALL);
+
 		gtk_tree_store_set(gtkblist->treemodel, &iter,
 				STATUS_ICON_COLUMN, status,
 				STATUS_ICON_VISIBLE_COLUMN, TRUE,
@@ -5543,7 +5547,7 @@ static void pidgin_blist_update_chat(Pur
 				BUDDY_ICON_VISIBLE_COLUMN,  purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"),
 				EMBLEM_COLUMN, emblem,
 				EMBLEM_VISIBLE_COLUMN, emblem != NULL,
-				PROTOCOL_ICON_COLUMN, pidgin_create_prpl_icon(chat->account, PIDGIN_PRPL_ICON_SMALL),
+				PROTOCOL_ICON_COLUMN, prpl_icon,
 				PROTOCOL_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"),
 				NAME_COLUMN, mark,
 				GROUP_EXPANDER_VISIBLE_COLUMN, FALSE,
@@ -5556,6 +5560,8 @@ static void pidgin_blist_update_chat(Pur
 			g_object_unref(status);
 		if(avatar)
 			g_object_unref(avatar);
+		if(prpl_icon)
+			g_object_unref(prpl_icon);
 	} else {
 		pidgin_blist_hide_node(list, node, TRUE);
 	}
============================================================
--- pidgin/gtklog.c	d96a7326a9b689b6dd2ad1560429ea82d93dee82
+++ pidgin/gtklog.c	84af7ea27729df07b80269725e050b79af2559fa
@@ -680,6 +680,7 @@ void pidgin_log_show(PurpleLogType type,
 	PidginLogViewer *lv = NULL;
 	const char *name = screenname;
 	char *title;
+	GdkPixbuf *prpl_icon;
 
 	g_return_if_fail(account != NULL);
 	g_return_if_fail(screenname != NULL);
@@ -717,9 +718,14 @@ void pidgin_log_show(PurpleLogType type,
 		title = g_strdup_printf(_("Conversations with %s"), name);
 	}
 
+	prpl_icon = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM);
+
 	display_log_viewer(ht, purple_log_get_logs(type, screenname, account),
-			title, gtk_image_new_from_pixbuf(pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_MEDIUM)), 
+			title, gtk_image_new_from_pixbuf(prpl_icon),
 			purple_log_get_total_size(type, screenname, account));
+
+	if (prpl_icon)
+		g_object_unref(prpl_icon);
 	g_free(title);
 }
 


More information about the Commits mailing list