Mercurial > pidgin.yaz
changeset 18452:45865fb3f4f9
Do not crash if you delete an account with an open conversation.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 07 Jul 2007 04:03:41 +0000 |
parents | 7122bcebf7c9 |
children | f50a82a14122 6b623a59cec6 37f4fb160937 2e064085b7df |
files | libpurple/account.c pidgin/gtkconv.c |
diffstat | 2 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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);
--- 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);