changeset 11423:202a3b3c5a88

[gaim-migrate @ 13660] Jason LeBrun asked for this on gaim-devel. gaim_buddy_icon_new() now leaves a reference for the caller. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Fri, 02 Sep 2005 06:57:54 +0000
parents 31a17ec5a307
children e1ab173ef3b5
files plugins/ChangeLog.API src/buddyicon.c
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/ChangeLog.API	Fri Sep 02 05:46:28 2005 +0000
+++ b/plugins/ChangeLog.API	Fri Sep 02 06:57:54 2005 +0000
@@ -78,6 +78,9 @@
 	* Changed: gaim_log_new(), added conv parameter
 	* Added:   gaim_buddy_icons_get_full_path(), to get the full path
 	           of a buddy icon setting
+	* Changed: gaim_buddy_icon_new(), leaves a reference which the caller
+	           owns. Use gaim_buddy_icon_unref() immediately if you don't
+	           want a reference (the old behavior).
 
 	Signals:
 	* Changed: "received-im-msg" and "received-chat-msg" to match, both
--- a/src/buddyicon.c	Fri Sep 02 05:46:28 2005 +0000
+++ b/src/buddyicon.c	Fri Sep 02 06:57:54 2005 +0000
@@ -75,11 +75,13 @@
 
 	gaim_buddy_icon_ref(icon);
 	gaim_buddy_icon_set_data(icon, icon_data, icon_len);
-	gaim_buddy_icon_unref(icon);
 
-	/* We don't take a reference here. gaim_buddy_icon_set_data() makes blist.c or
-	   conversation.c, or both, do that for us.
+	/* gaim_buddy_icon_set_data() makes blist.c or
+	 * conversation.c, or both, take a reference.
+	 *
+	 * Plus, we leave one for the caller of this function.
 	 */
+
 	return icon;
 }
 
@@ -412,7 +414,8 @@
 	}
 	else
 	{
-		gaim_buddy_icon_new(account, username, icon_data, icon_len);
+		GaimBuddyIcon *icon = gaim_buddy_icon_new(account, username, icon_data, icon_len);
+		gaim_buddy_icon_unref(icon);
 	}
 }