[grilo] core: when unloading a plugin, shutdown any sources it may have spawned.
- From: Iago Toral Quiroga <itoral src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] core: when unloading a plugin, shutdown any sources it may have spawned.
- Date: Fri, 3 Sep 2010 09:28:01 +0000 (UTC)
commit 2e3b8fa9dd05bbbf2d1eb3c1a532f712836171d4
Author: Iago Toral Quiroga <itoral igalia com>
Date: Thu Sep 2 14:49:00 2010 +0200
core: when unloading a plugin, shutdown any sources it may have spawned.
src/grl-plugin-registry.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/grl-plugin-registry.c b/src/grl-plugin-registry.c
index b12faec..5b9af12 100644
--- a/src/grl-plugin-registry.c
+++ b/src/grl-plugin-registry.c
@@ -636,16 +636,34 @@ grl_plugin_registry_unload (GrlPluginRegistry *registry,
const gchar *plugin_id)
{
GrlPluginDescriptor *plugin;
+ GrlMediaPlugin **sources;
+ gint i;
+
+ GRL_DEBUG ("grl_plugin_registry_unload: %s", plugin_id);
g_return_if_fail (GRL_IS_PLUGIN_REGISTRY (registry));
g_return_if_fail (plugin_id != NULL);
+ /* First check the plugin is valid */
plugin = g_hash_table_lookup (registry->priv->plugins, plugin_id);
if (!plugin) {
GRL_WARNING ("Could not deinit plugin '%s'. Plugin not found.", plugin_id);
return;
}
+ /* Second, shut down any sources spawned by this plugin */
+ GRL_DEBUG ("Shutting down sources spawned by '%s'", plugin_id);
+ sources = grl_plugin_registry_get_sources (registry, FALSE);
+ for (i=0; sources[i] != NULL; i++) {
+ const gchar *id;
+ id = grl_media_plugin_get_id (sources[i]);
+ if (!strcmp (plugin_id, id)) {
+ grl_plugin_registry_unregister_source (registry, sources[i]);
+ }
+ }
+ g_free (sources);
+
+ /* Third, shut down the plugin */
GRL_DEBUG ("Unloading plugin '%s'", plugin_id);
if (plugin->plugin_deinit) {
plugin->plugin_deinit ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]