From: <the...@us...> - 2006-11-06 07:25:27
|
Revision: 17681 http://svn.sourceforge.net/gaim/?rev=17681&view=rev Author: thekingant Date: 2006-11-05 23:25:05 -0800 (Sun, 05 Nov 2006) Log Message: ----------- Modified sf patch #1590052, from Ari Pollak Fixes two possible crashes that can happen after deleting an account Modified Paths: -------------- trunk/libgaim/account.c trunk/libgaim/savedstatuses.c Modified: trunk/libgaim/account.c =================================================================== --- trunk/libgaim/account.c 2006-11-06 06:54:14 UTC (rev 17680) +++ trunk/libgaim/account.c 2006-11-06 07:25:05 UTC (rev 17681) @@ -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); Modified: trunk/libgaim/savedstatuses.c =================================================================== --- trunk/libgaim/savedstatuses.c 2006-11-06 06:54:14 UTC (rev 17680) +++ trunk/libgaim/savedstatuses.c 2006-11-06 07:25:05 UTC (rev 17681) @@ -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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |