[glib/wip/gcleanup] giomodule: Cleanup global data
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/gcleanup] giomodule: Cleanup global data
- Date: Sun, 10 Nov 2013 21:36:12 +0000 (UTC)
commit 9258e510c36c5541e65428e3698c31d6287789f1
Author: Stef Walter <stefw gnome org>
Date: Thu Nov 7 23:00:08 2013 +0100
giomodule: Cleanup global data
https://bugzilla.gnome.org/show_bug.cgi?id=711799
gio/giomodule.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/gio/giomodule.c b/gio/giomodule.c
index 6eb48a4..76b61ae 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -693,7 +693,8 @@ _g_io_module_get_default_type (const gchar *extension_point,
}
else
{
- default_modules = g_hash_table_new (g_str_hash, g_str_equal);
+ default_modules = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ G_CLEANUP_IN_PHASE (default_modules, g_hash_table_unref, G_CLEANUP_PHASE_EARLY);
}
_g_io_modules_ensure_loaded ();
@@ -817,7 +818,9 @@ _g_io_module_get_default (const gchar *extension_point,
}
else
{
- default_modules = g_hash_table_new (g_str_hash, g_str_equal);
+ default_modules = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, g_object_unref);
+ G_CLEANUP_IN_PHASE (default_modules, g_hash_table_unref, G_CLEANUP_PHASE_EARLY);
}
_g_io_modules_ensure_loaded ();
@@ -1093,6 +1096,8 @@ _g_io_modules_ensure_loaded (void)
static void
g_io_extension_point_free (GIOExtensionPoint *ep)
{
+ GList *walk;
+
g_free (ep->name);
for (walk = ep->extensions; walk != NULL; walk = walk->next)
@@ -1124,10 +1129,12 @@ g_io_extension_point_register (const char *name)
G_LOCK (extension_points);
if (extension_points == NULL)
- extension_points = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- NULL,
- (GDestroyNotify)g_io_extension_point_free);
+ {
+ extension_points = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
+ (GDestroyNotify)g_io_extension_point_free);
+ G_CLEANUP_IN_PHASE (extension_points, g_hash_table_remove_all, G_CLEANUP_PHASE_EARLY);
+ G_CLEANUP_IN_PHASE (extension_points, g_hash_table_unref, G_CLEANUP_PHASE_LATE);
+ }
ep = g_hash_table_lookup (extension_points, name);
if (ep != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]