|
From: <the...@us...> - 2007-02-09 07:47:23
|
Revision: 18186
http://svn.sourceforge.net/gaim/?rev=18186&view=rev
Author: thekingant
Date: 2007-02-08 23:47:20 -0800 (Thu, 08 Feb 2007)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/libgaim/account.c
trunk/libgaim/prpl.c
Modified: trunk/libgaim/account.c
===================================================================
--- trunk/libgaim/account.c 2007-02-09 07:28:34 UTC (rev 18185)
+++ trunk/libgaim/account.c 2007-02-09 07:47:20 UTC (rev 18186)
@@ -827,8 +827,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)
@@ -838,6 +836,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,
Modified: trunk/libgaim/prpl.c
===================================================================
--- trunk/libgaim/prpl.c 2007-02-09 07:28:34 UTC (rev 18185)
+++ trunk/libgaim/prpl.c 2007-02-09 07:47:20 UTC (rev 18186)
@@ -221,31 +221,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;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|