Mercurial > pidgin.yaz
changeset 14909:c3a7d40d64bb
[gaim-migrate @ 17681]
Modified sf patch #1590052, from Ari Pollak
Fixes two possible crashes that can happen after deleting an account
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 06 Nov 2006 07:25:05 +0000 |
parents | fd321da41de4 |
children | fdbf71ae8775 |
files | libgaim/account.c libgaim/savedstatuses.c |
diffstat | 2 files changed, 34 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libgaim/account.c Mon Nov 06 06:54:14 2006 +0000 +++ b/libgaim/account.c Mon Nov 06 07:25:05 2006 +0000 @@ -2104,6 +2104,14 @@ g_return_if_fail(account != NULL); + /* + * Disable the account before blowing it out of the water. + * Conceptually it probably makes more sense to disable the + * account for all UIs rather than the just the current UI, + * but it doesn't really matter. + */ + gaim_account_set_enabled(account, gaim_core_get_ui(), FALSE); + if (gaim_account_is_connected(account)) gaim_account_disconnect(account);
--- a/libgaim/savedstatuses.c Mon Nov 06 06:54:14 2006 +0000 +++ b/libgaim/savedstatuses.c Mon Nov 06 07:25:05 2006 +0000 @@ -655,6 +655,27 @@ } } +/* + * This gets called when an account is deleted. We iterate through + * all of our saved statuses and delete any substatuses that may + * exist for this account. + */ +static void +gaim_savedstatus_unset_all_substatuses(const GaimAccount *account, + gpointer user_data) +{ + GList *iter; + GaimSavedStatus *status; + + g_return_if_fail(account != NULL); + + for (iter = saved_statuses; iter != NULL; iter = iter->next) + { + status = (GaimSavedStatus *)iter->data; + gaim_savedstatus_unset_substatus(status, account); + } +} + gboolean gaim_savedstatus_delete(const char *title) { @@ -1142,6 +1163,11 @@ GAIM_SUBTYPE_SAVEDSTATUS), gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_SAVEDSTATUS)); + + gaim_signal_connect(gaim_accounts_get_handle(), "account-removed", + handle, + GAIM_CALLBACK(gaim_savedstatus_unset_all_substatuses), + NULL); } void