[grilo] core: unload plugins properly by calling g_module_close when appropriate.
- From: Iago Toral Quiroga <itoral src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] core: unload plugins properly by calling g_module_close when appropriate.
- Date: Fri, 3 Sep 2010 09:27:56 +0000 (UTC)
commit 48dd489abb7b183bbd41ed64807b025a9aeff62e
Author: Iago Toral Quiroga <itoral igalia com>
Date: Wed Sep 1 14:43:48 2010 +0200
core: unload plugins properly by calling g_module_close when appropriate.
src/grl-plugin-registry.c | 5 +++++
src/grl-plugin-registry.h | 3 +++
2 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/grl-plugin-registry.c b/src/grl-plugin-registry.c
index 7007cf9..b12faec 100644
--- a/src/grl-plugin-registry.c
+++ b/src/grl-plugin-registry.c
@@ -448,6 +448,8 @@ grl_plugin_registry_load (GrlPluginRegistry *registry, const gchar *path)
return FALSE;
}
+ plugin->module = module;
+
GRL_DEBUG ("Loaded plugin '%s' from '%s'", plugin->info.id, path);
return TRUE;
@@ -648,6 +650,9 @@ grl_plugin_registry_unload (GrlPluginRegistry *registry,
if (plugin->plugin_deinit) {
plugin->plugin_deinit ();
}
+ if (plugin->module) {
+ g_module_close (plugin->module);
+ }
}
GrlKeyID
diff --git a/src/grl-plugin-registry.h b/src/grl-plugin-registry.h
index 45aa114..c82a956 100644
--- a/src/grl-plugin-registry.h
+++ b/src/grl-plugin-registry.h
@@ -85,6 +85,7 @@
.info = { id, NULL, NULL, 0 }, \
.plugin_init = init, \
.plugin_deinit = deinit, \
+ .module = NULL \
}
/* Plugin descriptor */
@@ -116,6 +117,7 @@ typedef struct _GrlPluginDescriptor GrlPluginDescriptor;
* the #GrlMediaPlugins provided
* @plugin_deinit: function to execute when the registry needs
* to dispose the module.
+* @module: the #GModule instance.
*
* This structure is used for the module loader
*/
@@ -123,6 +125,7 @@ struct _GrlPluginDescriptor {
GrlPluginInfo info;
gboolean (*plugin_init) (GrlPluginRegistry *, const GrlPluginInfo *, GList *);
void (*plugin_deinit) (void);
+ GModule *module;
};
/* Plugin ranks */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]