diff pidgin/gtkblist.c @ 16828:56823a55581a

Rework purple_buddy_icons_find() to return a reference for the caller, which is clearer and more consistent with other functions. Also, update purple_buddy_icons_set_for_user() to behave properly when called to clear an icon that isn't already in memory.
author Richard Laager <rlaager@wiktel.com>
date Thu, 03 May 2007 21:57:49 +0000
parents 1de66d5d1de8
children 9862a82206ba
line wrap: on
line diff
--- a/pidgin/gtkblist.c	Thu May 03 15:37:25 2007 +0000
+++ b/pidgin/gtkblist.c	Thu May 03 21:57:49 2007 +0000
@@ -2160,7 +2160,7 @@
 {
 	GdkPixbuf *buf, *ret = NULL;
 	GdkPixbufLoader *loader;
-	PurpleBuddyIcon *icon;
+	PurpleBuddyIcon *icon = NULL;
 	const guchar *data = NULL;
 	gsize len;
 	PurpleBuddy *buddy = NULL;
@@ -2197,9 +2197,9 @@
 	}
 
 	if (data == NULL) {
-		if (!(icon = purple_buddy_get_icon(buddy)))
-			if (!(icon = purple_buddy_icons_find(buddy->account, buddy->name))) /* Not sure I like this...*/
-				return NULL;
+		/* Not sure I like this...*/
+		if (!(icon = purple_buddy_icons_find(buddy->account, buddy->name)))
+			return NULL;
 		data = purple_buddy_icon_get_data(icon, &len);
 
 		if(data == NULL)
@@ -2211,6 +2211,7 @@
 	gdk_pixbuf_loader_close(loader, NULL);
 
 	purple_imgstore_unref(custom_img);
+	purple_buddy_icon_unref(icon);
 
 	buf = gdk_pixbuf_loader_get_pixbuf(loader);
 	if (buf)