[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: Fri, 8 Nov 2013 13:34:54 +0000 (UTC)
commit bdcf189b70a5e86d167e5e59246ddbda2ec715da
Author: Stef Walter <stefw gnome org>
Date: Fri Nov 8 14:26:12 2013 +0100
giomodule: Cleanup global data
gio/giomodule.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/gio/giomodule.c b/gio/giomodule.c
index cc120f0..c22a910 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -489,7 +489,7 @@ g_io_modules_scan_all_in_directory_with_scope (const char *dirname,
g_io_extension_point_register (extension_points[i]);
extension_point->lazy_load_modules =
g_list_prepend (extension_point->lazy_load_modules,
- module);
+ g_object_ref (module));
}
}
else
@@ -497,15 +497,11 @@ g_io_modules_scan_all_in_directory_with_scope (const char *dirname,
/* Try to load and init types */
if (g_type_module_use (G_TYPE_MODULE (module)))
g_type_module_unuse (G_TYPE_MODULE (module)); /* Unload */
- else
- { /* Failure to load */
- g_printerr ("Failed to load module: %s\n", path);
- g_object_unref (module);
- g_free (path);
- continue;
- }
+ else /* Failure to load */
+ g_printerr ("Failed to load module: %s\n", path);
}
+ g_object_unref (module);
g_free (path);
}
}
@@ -698,7 +694,8 @@ _g_io_module_get_default_type (const gchar *extension_point,
else
{
default_modules = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- G_CLEANUP (default_modules, g_hash_table_unref);
+ g_cleanup_list_push (G_CLEANUP_LIST, (GCleanupFunc)g_hash_table_unref, default_modules,
+ G_CLEANUP_PHASE_EARLY, NULL);
}
_g_io_modules_ensure_loaded ();
@@ -824,7 +821,8 @@ _g_io_module_get_default (const gchar *extension_point,
{
default_modules = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_object_unref);
- G_CLEANUP (default_modules, g_hash_table_unref);
+ g_cleanup_list_push (G_CLEANUP_LIST, (GCleanupFunc)g_hash_table_unref, default_modules,
+ G_CLEANUP_PHASE_EARLY, NULL);
}
_g_io_modules_ensure_loaded ();
@@ -1111,6 +1109,7 @@ g_io_extension_point_free (GIOExtensionPoint *ep)
g_free (extension->name);
g_slice_free (GIOExtension, extension);
}
+ g_list_free_full (ep->lazy_load_modules, g_object_unref);
g_list_free (ep->extensions);
g_free (ep);
@@ -1135,7 +1134,8 @@ g_io_extension_point_register (const char *name)
{
extension_points = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
(GDestroyNotify)g_io_extension_point_free);
- G_CLEANUP (extension_points, g_hash_table_unref);
+ g_cleanup_list_push (G_CLEANUP_LIST, (GCleanupFunc)g_hash_table_unref, extension_points,
+ G_CLEANUP_PHASE_EARLY, NULL);
}
ep = g_hash_table_lookup (extension_points, name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]