changeset 21588:837c382af6a4

prpl->set_buddy_icon may keep a reference to PurpleStoredImage, move the lookup to after the prpl callback because the prpl callback may unref the previous image
author Ka-Hing Cheung <khc@hxbc.us>
date Mon, 19 Nov 2007 07:44:51 +0000
parents 8fcd795f627e
children af5de2b08fe0
files libpurple/buddyicon.c
diffstat 1 files changed, 1 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/buddyicon.c	Mon Nov 19 02:45:41 2007 +0000
+++ b/libpurple/buddyicon.c	Mon Nov 19 07:44:51 2007 +0000
@@ -689,8 +689,6 @@
 	PurpleStoredImage *img = NULL;
 	char *old_icon;
 
-	old_img = g_hash_table_lookup(pointer_icon_cache, account);
-
 	if (icon_data != NULL && icon_len > 0)
 	{
 		img = purple_buddy_icon_data_new(icon_data, icon_len, NULL);
@@ -728,7 +726,7 @@
 			prpl_info->set_buddy_icon(gc, img);
 	}
 
-	if (old_img)
+	if ((old_img = g_hash_table_lookup(pointer_icon_cache, account)))
 		purple_imgstore_unref(old_img);
 	else if (old_icon)
 	{