fix crash when copy'ing latent plugins
[ardour.git] / libs / ardour / panner_manager.cc
index b14c7c79cf532efcf4a969e9495c327f4ef0ac47..c6b73b40775fbdac0ce8d58bd9ed723d600b0573 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "pbd/error.h"
 #include "pbd/compose.h"
-#include "pbd/pathscanner.h"
+#include "pbd/file_utils.h"
 #include "pbd/stl_delete.h"
 
 #include "ardour/debug.h"
@@ -32,7 +32,7 @@
 
 #include "ardour/search_paths.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
@@ -90,19 +90,15 @@ static bool panner_filter (const string& str, void */*arg*/)
 void
 PannerManager::discover_panners ()
 {
-       PathScanner scanner;
-       std::vector<std::string *> *panner_modules;
-       std::string search_path = panner_search_path().to_string();
+       std::vector<std::string> panner_modules;
 
-       DEBUG_TRACE (DEBUG::Panning, string_compose (_("looking for panners in %1\n"), search_path));
+       DEBUG_TRACE (DEBUG::Panning, string_compose (_("looking for panners in %1\n"), panner_search_path().to_string()));
 
-       panner_modules = scanner (search_path, panner_filter, 0, false, true, 1, true);
+       find_files_matching_filter (panner_modules, panner_search_path(), panner_filter, 0, false, true, true);
 
-       for (vector<std::string *>::iterator i = panner_modules->begin(); i != panner_modules->end(); ++i) {
-               panner_discover (**i);
+       for (vector<std::string>::iterator i = panner_modules.begin(); i != panner_modules.end(); ++i) {
+               panner_discover (*i);
        }
-
-       vector_delete (panner_modules);
 }
 
 int
@@ -123,6 +119,8 @@ PannerManager::panner_discover (string path)
                if (i == panner_info.end()) {
                        panner_info.push_back (pinfo);
                        DEBUG_TRACE (DEBUG::Panning, string_compose(_("Panner discovered: \"%1\" in %2\n"), pinfo->descriptor.name, path));
+               } else {
+                       delete pinfo;
                }
        }