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
/* 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);
}
}
done:
g_hash_table_insert (default_modules,
- g_strdup (extension_point),
- impl ? g_object_ref (impl) : NULL);
+ g_strdup (extension_point), impl);
g_rec_mutex_unlock (&default_modules_lock);
return impl;
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);
}