Update prototype API (3f739738) for windows/dll compat
authorRobin Gareus <robin@gareus.org>
Sun, 30 Oct 2016 16:38:24 +0000 (17:38 +0100)
committerRobin Gareus <robin@gareus.org>
Sun, 30 Oct 2016 16:39:55 +0000 (17:39 +0100)
memory allocated by a .dll must be free()d by the given dll.

libs/ardour/ardour/lv2_extensions.h
libs/ardour/lv2_plugin.cc

index f38ac8122aeca6146c1109abb17000abde782fe6..ebdf905fb3a7b94a4e8291ddf8bb664c5cb85945 100644 (file)
@@ -194,16 +194,26 @@ typedef struct {
 } LV2_Midnam;
 
 typedef struct {
-       /** query midnam document. The plugin
-        * is expected to return an allocated
-        * null-terminated XML text, which is
-        * safe for the host to pass to free().
+       /** Query midnam document. The plugin
+        * is expected to return a null-terminated XML
+        * text which is a valid midnam desciption
+        * (or NULL in case of error).
         *
         * The midnam <Model> must be unique and
         * specific for the given plugin-instance.
         */
        char* (*midnam)(LV2_Handle instance);
+
+       /** The unique model id used ith the midnam,
+        * (or NULL).
+        */
        char* (*model)(LV2_Handle instance);
+
+       /** free allocated strings. The host
+        * calls this for every value returned by
+        * \ref midnam and \ref model.
+        */
+       void (*free)(char*);
 } LV2_Midnam_Interface;
 
 /**
index 0892d86c330b61691688c6074116ace71a6634b7..94760dc336b356ac05243c8a16c95a0a3683f26c 100644 (file)
@@ -985,7 +985,7 @@ LV2Plugin::read_midnam () {
                MIDI::Name::MidiPatchManager::instance().remove_custom_midnam (ss.str());
                rv = MIDI::Name::MidiPatchManager::instance().add_custom_midnam (ss.str(), midnam);
        }
-       free (midnam);
+       _midname_interface->free (midnam);
        return rv;
 }
 
@@ -999,7 +999,7 @@ LV2Plugin::midnam_model () {
        if (model) {
                rv = model;
        }
-       free (model);
+       _midname_interface->free (model);
        return rv;
 }
 #endif