# HG changeset patch # User Mark Doliner # Date 1162797905 0 # Node ID c3a7d40d64bb2f6eaba9402e1bc81c1a85e05053 # Parent fd321da41de482da58c026ef50428e6eee958c6f [gaim-migrate @ 17681] Modified sf patch #1590052, from Ari Pollak Fixes two possible crashes that can happen after deleting an account committer: Tailor Script diff -r fd321da41de4 -r c3a7d40d64bb libgaim/account.c --- 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); diff -r fd321da41de4 -r c3a7d40d64bb libgaim/savedstatuses.c --- 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