libpurple/buddyicon.c

branch
rlaager.gaim_migration
changeset 16533
91e3e84b05f2
parent 16532
070f046b1316
child 16534
2ab9e23f99d9
--- 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

mercurial