changeset 16385:a0df0eb75e1b

Fix a bug with removing custom buddy icons.
author Richard Laager <rlaager@wiktel.com>
date Tue, 24 Apr 2007 20:23:50 +0000
parents 54ea8863b8e8
children e0c9a46b459f
files libpurple/buddyicon.c
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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