fix crash when copy'ing latent plugins
[ardour.git] / libs / ardour / audio_library.cc
index 4a6089dac3668ba6273a7d1c10b6122c4b51a9e6..2f09a37633062d55fc13f0be90c864c08a3be54c 100644 (file)
 #include <glibmm/convert.h>
 
 #include "pbd/compose.h"
+#include "pbd/error.h"
+#include "pbd/file_utils.h"
 
 #include "ardour/audio_library.h"
-#include "ardour/utils.h"
 #include "ardour/filesystem_paths.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace PBD;
@@ -105,15 +106,15 @@ AudioLibrary::get_tags (string member)
 {
        vector<string> tags;
 #ifdef HAVE_LRDF
+       char * uri = strdup(Glib::filename_to_uri(member).c_str());
 
        lrdf_statement pattern;
-       pattern.subject = strdup(Glib::filename_to_uri(member).c_str());
+       pattern.subject = uri;
        pattern.predicate = const_cast<char*>(TAG);
        pattern.object = 0;
        pattern.object_type = lrdf_literal;
 
        lrdf_statement* matches = lrdf_matches (&pattern);
-       free (pattern.subject);
 
        lrdf_statement* current = matches;
        while (current != 0) {
@@ -125,6 +126,7 @@ AudioLibrary::get_tags (string member)
        lrdf_free_statements (matches);
 
        sort (tags.begin(), tags.end());
+       free (uri);
 #endif
        return tags;
 }