From c781c7a5cd0c124b61f38a45ab4564fce022a89b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 18 Jan 2014 01:34:45 +0000 Subject: Call lv2_lib_descriptor separately for different bundle paths (fix loading several dynamic plugins like Ingen at once). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5314 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/ingen_lv2.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/server') diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index 8daf9b05..03ea7f72 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -814,11 +814,17 @@ const LV2_Lib_Descriptor* lv2_lib_descriptor(const char* bundle_path, const LV2_Feature*const* features) { - Lib* lib = new Lib(bundle_path); - static LV2_Lib_Descriptor desc = { - lib, sizeof(LV2_Lib_Descriptor), lib_cleanup, lib_get_plugin - }; - return &desc; + static const uint32_t desc_size = sizeof(LV2_Lib_Descriptor); + Lib* lib = new Lib(bundle_path); + + // FIXME: memory leak. I think the LV2_Lib_Descriptor API is botched :( + LV2_Lib_Descriptor* desc = (LV2_Lib_Descriptor*)malloc(desc_size); + desc->handle = lib; + desc->size = desc_size; + desc->cleanup = lib_cleanup; + desc->get_plugin = lib_get_plugin; + + return desc; } } // extern "C" -- cgit v1.2.1