From cb8ced74b5ada9e8babf2ca8a429845eefc78fb9 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 2 Mar 2009 21:04:39 +0000 Subject: [PATCH] prevent double-listing of LADSPA plugins caused by symlinks to library directories (e.g. lib64 -> lib) git-svn-id: svn://localhost/ardour2/branches/3.0@4722 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/plugin_manager.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index 439768c07e..497ac04896 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -313,6 +313,7 @@ PluginManager::ladspa_discover (string path) const LADSPA_Descriptor *descriptor; LADSPA_Descriptor_Function dfunc; const char *errstr; + bool first = true; if ((module = dlopen (path.c_str(), RTLD_NOW)) == 0) { error << string_compose(_("LADSPA: cannot load module \"%1\" (%2)"), path, dlerror()) << endmsg; @@ -364,7 +365,23 @@ PluginManager::ladspa_discover (string path) } } - _ladspa_plugin_info.push_back (info); + if(_ladspa_plugin_info.empty()){ + _ladspa_plugin_info.push_back (info); + } + + //Ensure that the plugin is not already in the plugin list. + + bool found = false; + + for (PluginInfoList::const_iterator i = _ladspa_plugin_info.begin(); i != _ladspa_plugin_info.end(); ++i) { + if(0 == info->unique_id.compare((*i)->unique_id)){ + found = true; + } + } + + if(!found){ + _ladspa_plugin_info.push_back (info); + } } // GDB WILL NOT LIKE YOU IF YOU DO THIS -- 2.30.2