# HG changeset patch # User Sadrul Habib Chowdhury # Date 1264627778 0 # Node ID 45123312b7a9bc64208e5746b38865b9def92f3b # Parent c833ae72599bbf8d253dedab86a9790a6e2a36f9 Fix a crash when setting a buddyicon. The patches are to fix the crash that happens when you have yourself in your buddylist, and you try to change the avatar. (the crash has a higher probability of happening when you change it for the first time after restarting pidgin). The idea of the patch is to keep a ref for the insertion in the hash-table, so that lines oscar.c:5551-5553 (and similar code in other prpls) don't create and remove a stored-image, and leave an invalid img in buddyicon.c:pointer_icon_cache diff -r c833ae72599b -r 45123312b7a9 libpurple/buddyicon.c --- a/libpurple/buddyicon.c Wed Jan 27 21:24:15 2010 +0000 +++ b/libpurple/buddyicon.c Wed Jan 27 21:29:38 2010 +0000 @@ -716,9 +716,8 @@ if (read_icon_file(path, &data, &len)) { g_free(path); - img = purple_buddy_icon_data_new(data, len, account_icon_file); - g_hash_table_insert(pointer_icon_cache, account, img); - return img; + img = purple_buddy_icons_set_account_icon(account, data, len); + return purple_imgstore_ref(img); } g_free(path); @@ -841,9 +840,8 @@ if (read_icon_file(path, &data, &len)) { g_free(path); - img = purple_buddy_icon_data_new(data, len, custom_icon_file); - g_hash_table_insert(pointer_icon_cache, node, img); - return img; + img = purple_buddy_icons_node_set_custom_icon(node, data, len); + return purple_imgstore_ref(img); } g_free(path);