# HG changeset patch # User Richard Laager # Date 1177446230 0 # Node ID a0df0eb75e1bf9ef68ed66df24f524e664b2af8d # Parent 54ea8863b8e8e8b818d1f49de78c4f5da32f1c8e Fix a bug with removing custom buddy icons. diff -r 54ea8863b8e8 -r a0df0eb75e1b libpurple/buddyicon.c --- a/libpurple/buddyicon.c Tue Apr 24 19:58:14 2007 +0000 +++ b/libpurple/buddyicon.c Tue Apr 24 20:23:50 2007 +0000 @@ -638,7 +638,6 @@ "custom_buddy_icon"); } unref_filename(old_icon); - g_free(old_icon); g_hash_table_insert(custom_icon_cache, contact, img); @@ -661,7 +660,16 @@ purple_blist_update_buddy_icon(buddy); } - purple_imgstore_unref(old_img); + if (old_img) + purple_imgstore_unref(old_img); + else + { + /* The old icon may not have been loaded into memory. In that + * case, we'll need to uncache the filename. The filenames + * are ref-counted, so this is safe. */ + purple_buddy_icon_data_uncache_file(old_icon); + } + g_free(old_icon); } void