# HG changeset patch # User Mark Doliner # Date 1171006921 0 # Node ID f485c87e654629190af8c237f0b073498ab2a988 # Parent 0a5823d45398a934bb76b800df90fbc4130d35a2 sf patch #1655057, from Peter Tang Fix a memory leak when signing off an account, I think. Peter Tang found it and suggested one fix. I suggested another, then Sadrul made it work. I like this change. We're now re-using GaimStatusType objects instead of making lots of copies of them. diff -r 0a5823d45398 -r f485c87e6546 COPYRIGHT --- a/COPYRIGHT Fri Feb 09 07:34:51 2007 +0000 +++ b/COPYRIGHT Fri Feb 09 07:42:01 2007 +0000 @@ -316,6 +316,7 @@ Sun Microsystems MÃ¥rten Svantesson (fursten) Robert T. +Peter Tang Brian Tarricone Peter Teichman Philip Tellis diff -r 0a5823d45398 -r f485c87e6546 libpurple/account.c --- a/libpurple/account.c Fri Feb 09 07:34:51 2007 +0000 +++ b/libpurple/account.c Fri Feb 09 07:42:01 2007 +0000 @@ -835,8 +835,6 @@ /* 0 is not a valid privacy setting */ account->perm_deny = GAIM_PRIVACY_ALLOW_ALL; - account->presence = gaim_presence_new_for_account(account); - prpl = gaim_find_prpl(protocol_id); if (prpl == NULL) @@ -846,6 +844,8 @@ if (prpl_info != NULL && prpl_info->status_types != NULL) gaim_account_set_status_types(account, prpl_info->status_types(account)); + account->presence = gaim_presence_new_for_account(account); + status_type = gaim_account_get_status_type_with_primitive(account, GAIM_STATUS_AVAILABLE); if (status_type != NULL) gaim_presence_set_status_active(account->presence, diff -r 0a5823d45398 -r f485c87e6546 libpurple/prpl.c --- a/libpurple/prpl.c Fri Feb 09 07:34:51 2007 +0000 +++ b/libpurple/prpl.c Fri Feb 09 07:42:01 2007 +0000 @@ -165,12 +165,9 @@ void gaim_prpl_got_user_status_deactive(GaimAccount *account, const char *name, const char *status_id) { - GSList *list; GaimBuddy *buddy; GaimPresence *presence; GaimStatus *status; - GaimStatus *old_status; - va_list args; g_return_if_fail(account != NULL); g_return_if_fail(name != NULL); @@ -246,31 +243,20 @@ GList * gaim_prpl_get_statuses(GaimAccount *account, GaimPresence *presence) { - GaimPlugin *prpl; - GaimPluginProtocolInfo *prpl_info; GList *statuses = NULL; - GList *l, *list; + const GList *l; GaimStatus *status; g_return_val_if_fail(account != NULL, NULL); g_return_val_if_fail(presence != NULL, NULL); - prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); - - if (prpl == NULL) - return NULL; - - prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); - if (prpl_info == NULL || prpl_info->status_types == NULL) - return NULL; - - for (l = list = prpl_info->status_types(account); l != NULL; l = l->next) + for (l = gaim_account_get_status_types(account); l != NULL; l = l->next) { status = gaim_status_new((GaimStatusType *)l->data, presence); - statuses = g_list_append(statuses, status); + statuses = g_list_prepend(statuses, status); } - g_list_free(list); + statuses = g_list_reverse(statuses); return statuses; } diff -r 0a5823d45398 -r f485c87e6546 libpurple/status.c --- a/libpurple/status.c Fri Feb 09 07:34:51 2007 +0000 +++ b/libpurple/status.c Fri Feb 09 07:42:01 2007 +0000 @@ -1549,7 +1549,7 @@ gaim_presence_is_status_primitive_active(const GaimPresence *presence, GaimStatusPrimitive primitive) { - GList *l; + const GList *l; g_return_val_if_fail(presence != NULL, FALSE); g_return_val_if_fail(primitive != GAIM_STATUS_UNSET, FALSE);