[Galago-commits] r2847 - in trunk/galago-daemon: . src
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Tue Jun 13 23:38:31 PDT 2006
Author: chipx86
Date: 2006-06-13 23:38:26 -0700 (Tue, 13 Jun 2006)
New Revision: 2847
Modified:
trunk/galago-daemon/ChangeLog
trunk/galago-daemon/src/account-list.c
trunk/galago-daemon/src/coco.c
Log:
Patch by Jorn Baayen to fix some memory leaks and fix a bug in coco unreffing in galagod_cocos_uninit().
Modified: trunk/galago-daemon/ChangeLog
===================================================================
--- trunk/galago-daemon/ChangeLog 2006-06-13 06:11:06 UTC (rev 2846)
+++ trunk/galago-daemon/ChangeLog 2006-06-14 06:38:26 UTC (rev 2847)
@@ -1,3 +1,10 @@
+Tue Jun 13 23:36:32 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
+
+ * src/account-list.c:
+ * src/coco.c:
+ - Patch by Jorn Baayen to fix some memory leaks and fix a bug in
+ coco unreffing in galagod_cocos_uninit().
+
Mon May 22 01:25:54 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
* src/meta-service.c:
Modified: trunk/galago-daemon/src/account-list.c
===================================================================
--- trunk/galago-daemon/src/account-list.c 2006-06-13 06:11:06 UTC (rev 2846)
+++ trunk/galago-daemon/src/account-list.c 2006-06-14 06:38:26 UTC (rev 2847)
@@ -154,8 +154,8 @@
list->meta_accounts = g_list_append(list->meta_accounts, meta_account);
g_hash_table_insert(list->meta_accounts_table,
- g_strdup(galago_service_normalize(service, username)),
- meta_account);
+ galago_service_normalize(service, username),
+ meta_account);
list->meta_account_count++;
@@ -170,6 +170,7 @@
GalagoAccount *main_account;
GalagoService *service;
const char *username;
+ char *normalized;
g_return_if_fail(list != NULL);
g_return_if_fail(meta_account != NULL);
@@ -178,8 +179,10 @@
service = galago_account_get_service(main_account);
username = galago_account_get_username(main_account);
- g_hash_table_remove(list->meta_accounts_table,
- galago_service_normalize(service, username));
+ normalized = galago_service_normalize(service, username);
+ g_hash_table_remove(list->meta_accounts_table, normalized);
+ g_free(normalized);
+
list->meta_accounts = g_list_remove(list->meta_accounts, meta_account);
list->meta_account_count--;
@@ -207,14 +210,17 @@
{
GalagoService *service;
GalagodMetaAccount *meta_account;
+ char *normalized;
g_return_val_if_fail(list != NULL, NULL);
g_return_val_if_fail(id != NULL, NULL);
service = galagod_meta_service_get_service(list->meta_service);
+ normalized = galago_service_normalize(service, id);
meta_account = g_hash_table_lookup(list->meta_accounts_table,
- galago_service_normalize(service, id));
+ normalized);
+ g_free(normalized);
return meta_account;
}
Modified: trunk/galago-daemon/src/coco.c
===================================================================
--- trunk/galago-daemon/src/coco.c 2006-06-13 06:11:06 UTC (rev 2846)
+++ trunk/galago-daemon/src/coco.c 2006-06-14 06:38:26 UTC (rev 2847)
@@ -263,15 +263,29 @@
}
static void
-destroy_each_coco(gpointer key, gpointer value, gpointer user_data)
+list_each_coco(gpointer key, gpointer value, GList **list)
{
- g_object_unref(value);
+ *list = g_list_append(*list, value);
}
void
galagod_cocos_uninit(void)
{
- g_hash_table_foreach(_cocos, destroy_each_coco, NULL);
+ GList *list = NULL;
+
+ /*
+ * List all cocos, and then destroy them. We can't do it
+ * while iterating the hashtable, because galagod_coco_finalize()
+ * calls g_hash_table_remove().
+ */
+ g_hash_table_foreach(_cocos, (GHFunc)list_each_coco, &list);
+
+ while (list != NULL)
+ {
+ g_object_unref(list->data);
+ list = g_list_delete_link(list, list);
+ }
+
g_hash_table_destroy(_cocos);
g_hash_table_destroy(_coco_ids);
More information about the galago-commits
mailing list