# HG changeset patch # User Ka-Hing Cheung # Date 1195458291 0 # Node ID 837c382af6a4afe6db7be66dfe9e88b32628123d # Parent 8fcd795f627ef91cbecdf97987de71ac328206b3 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 diff -r 8fcd795f627e -r 837c382af6a4 libpurple/buddyicon.c --- 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) {