Mercurial > pidgin.yaz
changeset 9928:5d8d73c2eebe
[gaim-migrate @ 10820]
this shouldn't break anything, and doesn't seem to
it might even fix the stupid negative buddy count problem
thanks datallah
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Wed, 01 Sep 2004 01:13:21 +0000 |
parents | fb08a0973b3e |
children | 24550263874d |
files | src/blist.c |
diffstat | 1 files changed, 22 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/blist.c Wed Sep 01 01:07:42 2004 +0000 +++ b/src/blist.c Wed Sep 01 01:13:21 2004 +0000 @@ -965,7 +965,6 @@ GaimBlistUiOps *ops = gaimbuddylist->ui_ops; GaimGroup *g; GaimBlistNode *gnode, *cnode, *bnode; - gboolean empty_contact = FALSE; g_return_if_fail(contact != NULL); g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT((GaimBlistNode*)contact)); @@ -995,19 +994,10 @@ if (cnode->next) cnode->next->prev = cnode->prev; - - if (contact->online > 0) - ((GaimGroup*)cnode->parent)->online--; - if (contact->currentsize > 0) - ((GaimGroup*)cnode->parent)->currentsize--; - ((GaimGroup*)cnode->parent)->totalsize--; - - ops->remove(gaimbuddylist, cnode); - - schedule_blist_save(); - if (cnode->parent != gnode) { - for (bnode = cnode->child; bnode; bnode = bnode->next) { + bnode = cnode->child; + while (bnode) { + GaimBlistNode *next_bnode = bnode->next; GaimBuddy *b = (GaimBuddy*)bnode; struct _gaim_hbuddy *hb = g_new(struct _gaim_hbuddy, 1); @@ -1024,6 +1014,8 @@ if (b->account->gc) serv_move_buddy(b, (GaimGroup *)cnode->parent, g); } else { + gboolean empty_contact = FALSE; + /* this buddy already exists in the group, so we're * gonna delete it instead */ g_free(hb->name); @@ -1034,15 +1026,28 @@ if (!cnode->child->next) empty_contact = TRUE; gaim_blist_remove_buddy(b); + + /** in gaim_blist_remove_buddy(), if the last buddy in a + * contact is removed, the contact is cleaned up and + * g_free'd, so we mustn't try to reference bnode->next */ + if (empty_contact) + return; } + bnode = next_bnode; } } + + if (contact->online > 0) + ((GaimGroup*)cnode->parent)->online--; + if (contact->currentsize > 0) + ((GaimGroup*)cnode->parent)->currentsize--; + ((GaimGroup*)cnode->parent)->totalsize--; + + ops->remove(gaimbuddylist, cnode); + + schedule_blist_save(); } - if (empty_contact) - return; - - if (node && (GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_CHAT(node))) { if (node->next)