[glib/wip/gcleanup: 44/71] giomodule: Cleanup global data
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/gcleanup: 44/71] giomodule: Cleanup global data
- Date: Wed, 13 Nov 2013 11:37:57 +0000 (UTC)
commit d8408280884e63845c04c2563a1691813ba9ca70
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 | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/gio/giomodule.c b/gio/giomodule.c
index 17d55de..3e2efe8 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -697,7 +697,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 (default_modules, g_hash_table_unref, G_CLEANUP_PHASE_EARLY);
}
_g_io_modules_ensure_loaded ();
@@ -821,7 +822,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 (default_modules, g_hash_table_unref, G_CLEANUP_PHASE_EARLY);
}
_g_io_modules_ensure_loaded ();
@@ -1118,10 +1121,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 (extension_points, g_hash_table_remove_all, G_CLEANUP_PHASE_EARLY);
+ G_CLEANUP_IN (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]