diff options
author | Jens Georg <mail@jensge.org> | 2020-07-26 19:17:17 +0200 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2020-07-26 19:17:21 +0200 |
commit | f4392bc13ba1de447c1a3e0f6a6a6ec26c609f72 (patch) | |
tree | 26f00a76ff76c886cac193d6722f85fecc345da8 | |
parent | c5486099b6c0afc05cbbd4809934b109130ee9a3 (diff) | |
download | rygel-f4392bc13ba1de447c1a3e0f6a6a6ec26c609f72.tar.gz |
core: Load if conflict with disabled plugin
If a plugin that is loaded conflicts with another plugin that is
disabled, load anyway. Only if the module is really loaded into the
process, refuse to load it
-rw-r--r-- | src/librygel-core/rygel-plugin-information.vala | 3 | ||||
-rw-r--r-- | src/librygel-core/rygel-plugin-loader.vala | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/librygel-core/rygel-plugin-information.vala b/src/librygel-core/rygel-plugin-information.vala index 845a81d5..3dd24455 100644 --- a/src/librygel-core/rygel-plugin-information.vala +++ b/src/librygel-core/rygel-plugin-information.vala @@ -44,6 +44,9 @@ public class Rygel.PluginInformation : Object { /// Name of other plugins this plugin conflicts with public GenericSet<string> conflicts { get; construct; } + /// Whether the module was loaded or not + public bool module_loaded { get; set; default = false; } + private PluginInformation (string module_path, string name, GenericSet<string> conflicts) { diff --git a/src/librygel-core/rygel-plugin-loader.vala b/src/librygel-core/rygel-plugin-loader.vala index 78dc8189..a6492a7c 100644 --- a/src/librygel-core/rygel-plugin-loader.vala +++ b/src/librygel-core/rygel-plugin-loader.vala @@ -29,7 +29,7 @@ using Gee; /** * This class is responsible for plugin loading. * - * It probes for shared library files in a specific directory, tries to + * It probes for shared library files in a specific directory, tries to * find a module_init() function with this signature: * ``void module_init (RygelPluginLoader* loader);`` * @@ -151,7 +151,8 @@ public class Rygel.PluginLoader : RecursiveModuleLoader { debug ("Trying to load plugin '%s'", info.name); foreach (var conflicting in info.conflicts.get_values ()) { - if (this.available_plugins.has_key (conflicting)) { + if (this.available_plugins.has_key (conflicting) && + this.available_plugins[conflicting].module_loaded) { message (_("Module '%s' conflicts with already loaded module '%s'. Skipping"), info.name, conflicting); @@ -170,7 +171,10 @@ public class Rygel.PluginLoader : RecursiveModuleLoader { var module_file = File.new_for_path (info.module_path); - return this.load_module_from_file (module_file); + var loaded = this.load_module_from_file (module_file); + info.module_loaded = loaded; + + return loaded; } private void on_section_changed (string section, SectionEntry entry) { |