# HG changeset patch # User Jeffrey Connelly # Date 1187935888 0 # Node ID 5ed02bbcf1ff02e783b404a27b20a5480099d913 # Parent b22a33d3fc958d51e4dec6f5d7f990324ea01aa3 Add an assertion in purple_blist_add_{chat,buddy} to return if a buddy was added to the buddy list in a group that is not in the buddy list. This improper usage previously caused duplicate groups to be shown in the buddy list, which are then dropped after restarting Pidgin. This change may incur a performance hit on every buddy added to the buddy list with a non-null group. If this performance is noticeably worse, an alternate assertion (which is less readable) can be used as #2752. Closes #2752. diff -r b22a33d3fc95 -r 5ed02bbcf1ff libpurple/blist.c --- a/libpurple/blist.c Fri Aug 24 04:34:18 2007 +0000 +++ b/libpurple/blist.c Fri Aug 24 06:11:28 2007 +0000 @@ -1190,6 +1190,9 @@ group = purple_group_new(_("Chats")); purple_blist_add_group(group, purple_blist_get_last_sibling(purplebuddylist->root)); + } else { + /* Fail if tried to add buddy to a group that isn't on the blist. #2752. */ + g_return_if_fail(purple_find_group(group->name)); } } else { group = (PurpleGroup*)node->parent; @@ -1284,6 +1287,10 @@ g = (PurpleGroup *)((PurpleBlistNode *)c)->parent; } else { if (group) { + /* Fail if trying to add buddy to a group that is not on the buddy list. + * Fix for #2752. */ + g_return_if_fail(purple_find_group(group->name)); + g = group; } else { g = purple_group_new(_("Buddies"));