[glib] Revert "giomodule: Fix leaks in module loading"
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Revert "giomodule: Fix leaks in module loading"
- Date: Mon, 11 Nov 2013 16:26:40 +0000 (UTC)
commit a638be8a790a67688066229f239a612194cdff70
Author: Stef Walter <stefw gnome org>
Date: Thu Nov 7 22:56:11 2013 +0100
Revert "giomodule: Fix leaks in module loading"
This reverts commit dc72039c162e1ca6400f28f92dd8e090ce99bd3f.
This depends on a patch that allows GTypeModule to be finalized.
Lets put this back in bugzilla until that gets in.
gio/giomodule.c | 28 ++++++++++------------------
1 files changed, 10 insertions(+), 18 deletions(-)
---
diff --git a/gio/giomodule.c b/gio/giomodule.c
index 6297f22..17d55de 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,
- g_object_ref (module));
+ module);
}
}
else
@@ -497,11 +497,15 @@ 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);
+ else
+ { /* Failure to load */
+ g_printerr ("Failed to load module: %s\n", path);
+ g_object_unref (module);
+ g_free (path);
+ continue;
+ }
}
- g_object_unref (module);
g_free (path);
}
}
@@ -861,7 +865,8 @@ _g_io_module_get_default (const gchar *extension_point,
done:
g_hash_table_insert (default_modules,
- g_strdup (extension_point), impl);
+ g_strdup (extension_point),
+ impl ? g_object_ref (impl) : NULL);
g_rec_mutex_unlock (&default_modules_lock);
return impl;
@@ -1093,20 +1098,7 @@ _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)
- {
- GIOExtension *extension = walk->data;
-
- 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]