changeset 10166:72c9e9bb2c19

[gaim-migrate @ 11252] A nice contact-deletion crash fix from Andrew Hart. Thanks Andrew! committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 09 Nov 2004 05:48:26 +0000
parents 5c3b27763126
children cf45c2a6a7cf
files src/blist.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/blist.c	Tue Nov 09 05:41:41 2004 +0000
+++ b/src/blist.c	Tue Nov 09 05:48:26 2004 +0000
@@ -1179,11 +1179,18 @@
 	if (node->child) {
 		/*
 		 * If this contact has children then remove them.  When the last
-		 * buddy is removed from the contact, the contact is deleted.
+		 * buddy is removed from the contact, the contact is automatically
+		 * deleted.
 		 */
-		while (node->child) {
+		while (node->child->next) {
 			gaim_blist_remove_buddy((GaimBuddy*)node->child);
 		}
+		/*
+		 * Remove the last buddy and trigger the deletion of the contact.
+		 * It would probably be cleaner if contact-deletion was done after 
+		 * a timeout?  Or if it had to be done manually, like below?
+		 */
+		gaim_blist_remove_buddy((GaimBuddy*)node->child);
 	} else {
 		/* Remove the node from its parent */
 		if (gnode->child == node)