[grilo] core: Check if plugin is already loaded



commit 19ecd892b71394368d39188063c33177c9e21c35
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Fri Apr 8 15:54:48 2011 +0000

    core: Check if plugin is already loaded
    
    When loading a plugin, check if the plugin is already loaded. If so then skip
    it and return an error.
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>

 src/grl-plugin-registry.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/grl-plugin-registry.c b/src/grl-plugin-registry.c
index 9d53373..0f0a2e1 100644
--- a/src/grl-plugin-registry.c
+++ b/src/grl-plugin-registry.c
@@ -500,6 +500,17 @@ grl_plugin_registry_load (GrlPluginRegistry *registry,
     return FALSE;
   }
 
+  /* Check if plugin is already loaded */
+  if (g_hash_table_lookup (registry->priv->plugins, plugin->plugin_id)) {
+    GRL_WARNING ("Plugin is already loaded: '%s'", path);
+    g_set_error (error,
+                 GRL_CORE_ERROR,
+                 GRL_CORE_ERROR_LOAD_PLUGIN_FAILED,
+                 "'%s' is already loaded", path);
+    g_module_close (module);
+    return FALSE;
+  }
+
   plugin_info = g_hash_table_lookup (registry->priv->plugin_infos,
                                      plugin->plugin_id);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]