Mercurial > pidgin
changeset 20872:71d0989b7c25
Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 10 Oct 2007 04:11:52 +0000 |
parents | 34fc2a999977 |
children | 7dfb2ff2e75c |
files | pidgin/gtkblist.c pidgin/gtklog.c |
diffstat | 2 files changed, 20 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkblist.c Wed Oct 10 02:18:48 2007 +0000 +++ b/pidgin/gtkblist.c Wed Oct 10 04:11:52 2007 +0000 @@ -5300,7 +5300,7 @@ 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 @@ if (editing_blist) return; - + status = pidgin_blist_get_status_icon((PurpleBlistNode*)buddy, PIDGIN_STATUS_ICON_SMALL); @@ -5357,6 +5357,8 @@ } } + 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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); }
--- a/pidgin/gtklog.c Wed Oct 10 02:18:48 2007 +0000 +++ b/pidgin/gtklog.c Wed Oct 10 04:11:52 2007 +0000 @@ -680,6 +680,7 @@ 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 @@ 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); }