# HG changeset patch # User Sadrul Habib Chowdhury # Date 1183781021 0 # Node ID 45865fb3f4f93c9a6214c8e27eea70c5405a92f5 # Parent 7122bcebf7c93ef173a1177f41dbf26b6a4c6d4a Do not crash if you delete an account with an open conversation. diff -r 7122bcebf7c9 -r 45865fb3f4f9 libpurple/account.c --- a/libpurple/account.c Sat Jul 07 00:30:45 2007 +0000 +++ b/libpurple/account.c Sat Jul 07 04:03:41 2007 +0000 @@ -2183,6 +2183,7 @@ purple_accounts_delete(PurpleAccount *account) { PurpleBlistNode *gnode, *cnode, *bnode; + GList *iter; g_return_if_fail(account != NULL); @@ -2231,6 +2232,14 @@ } } + /* Remove any open conversation for this account */ + for (iter = purple_get_conversations(); iter; ) { + PurpleConversation *conv = iter->data; + iter = iter->next; + if (purple_conversation_get_account(conv) == account) + purple_conversation_destroy(conv); + } + /* Remove this account's pounces */ purple_pounce_destroy_all_by_account(account); diff -r 7122bcebf7c9 -r 45865fb3f4f9 pidgin/gtkconv.c --- a/pidgin/gtkconv.c Sat Jul 07 00:30:45 2007 +0000 +++ b/pidgin/gtkconv.c Sat Jul 07 04:03:41 2007 +0000 @@ -4857,8 +4857,14 @@ gtkconv->convs = g_list_remove(gtkconv->convs, conv); /* Don't destroy ourselves until all our convos are gone */ - if (gtkconv->convs) + if (gtkconv->convs) { + /* Make sure the destroyed conversation is not the active one */ + if (gtkconv->active_conv == conv) { + gtkconv->active_conv = gtkconv->convs->data; + purple_conversation_update(gtkconv->active_conv, PURPLE_CONV_UPDATE_FEATURES); + } return; + } pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv);