changeset 26831:7ff22eb86083

merge of '48b95d7d853b96052d4478dd475e60a97e7bda8b' and 'd25c9ed783b024f75fac25f2320ddf5df6907c36'
author Marcus Lundblad <ml@update.uu.se>
date Wed, 06 May 2009 19:03:22 +0000
parents 6028712210ca (current diff) 6eb0e3a9c919 (diff)
children 048dd3fa29d7
files
diffstat 2 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/null/nullprpl.c	Wed May 06 19:01:31 2009 +0000
+++ b/libpurple/protocols/null/nullprpl.c	Wed May 06 19:03:22 2009 +0000
@@ -909,7 +909,8 @@
 static void nullprpl_set_buddy_icon(PurpleConnection *gc,
                                     PurpleStoredImage *img) {
  purple_debug_info("nullprpl", "setting %s's buddy icon to %s\n",
-                   gc->account->username, purple_imgstore_get_filename(img));
+                   gc->account->username,
+                   img ? purple_imgstore_get_filename(img) : "(null)");
 }
 
 static void nullprpl_remove_group(PurpleConnection *gc, PurpleGroup *group) {
--- a/pidgin/gtkstatusbox.c	Wed May 06 19:01:31 2009 +0000
+++ b/pidgin/gtkstatusbox.c	Wed May 06 19:03:22 2009 +0000
@@ -471,6 +471,12 @@
 			img = purple_imgstore_new_from_file(filename);
 
 		pidgin_status_box_set_buddy_icon(status_box, img);
+		if (img)
+			/*
+			 * purple_imgstore_new gives us a reference and
+			 * pidgin_status_box_set_buddy_icon also takes one.
+			 */
+			purple_imgstore_unref(img);
 	}
 
 	status_box->hand_cursor = gdk_cursor_new (GDK_HAND2);
@@ -1467,6 +1473,13 @@
 				if (filename)
 					data = pidgin_convert_buddy_icon(plug, filename, &len);
 				img = purple_buddy_icons_set_account_icon(box->account, data, len);
+				if (img)
+					/*
+					 * set_account_icon doesn't give us a reference, but we
+					 * unref one below (for the other code path)
+					 */
+					purple_imgstore_ref(img);
+
 				purple_account_set_buddy_icon_path(box->account, filename);
 
 				purple_account_set_bool(box->account, "use-global-buddyicon", (filename != NULL));
@@ -1486,7 +1499,7 @@
 					size_t len = 0;
 					if (filename)
 						data = pidgin_convert_buddy_icon(plug, filename, &len);
-					img = purple_buddy_icons_set_account_icon(account, data, len);
+					purple_buddy_icons_set_account_icon(account, data, len);
 					purple_account_set_buddy_icon_path(account, filename);
 				}
 			}
@@ -1498,6 +1511,8 @@
 	}
 
 	pidgin_status_box_set_buddy_icon(box, img);
+	if (img)
+		purple_imgstore_unref(img);
 }
 
 static void