From b1697a75acd0a3a88e68906fd657354c137b8785 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 14 Mar 2011 21:02:51 +0000 Subject: [PATCH] Fix LV2 UI related memory errors with new SLV2. git-svn-id: svn://localhost/ardour2/branches/3.0@9150 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/lv2_plugin_ui.cc | 13 ++++++------- gtk2_ardour/lv2_plugin_ui.h | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gtk2_ardour/lv2_plugin_ui.cc b/gtk2_ardour/lv2_plugin_ui.cc index 3a73453dbe..ead7440b3a 100644 --- a/gtk2_ardour/lv2_plugin_ui.cc +++ b/gtk2_ardour/lv2_plugin_ui.cc @@ -31,7 +31,8 @@ using namespace ARDOUR; using namespace PBD; #ifdef HAVE_NEW_SLV2 -SLV2UIHost LV2PluginUI::ui_host = NULL; +SLV2UIHost LV2PluginUI::ui_host = NULL; +SLV2Value LV2PluginUI::ui_GtkUI = NULL; #endif void @@ -171,16 +172,14 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title) #ifdef HAVE_NEW_SLV2 if (!LV2PluginUI::ui_host) { + LV2PluginUI::ui_GtkUI = slv2_value_new_uri( + ARDOUR::PluginManager::the_manager()->lv2_world()->world, + "http://lv2plug.in/ns/extensions/ui#GtkUI"); LV2PluginUI::ui_host = slv2_ui_host_new( LV2PluginUI::lv2_ui_write, NULL, NULL, NULL); } - SLV2Value gtk_ui = slv2_value_new_uri( - ARDOUR::PluginManager::the_manager()->lv2_world()->world, - "http://lv2plug.in/ns/extensions/ui#GtkUI"); _inst = slv2_ui_instance_new( - _lv2->slv2_plugin(), _lv2->slv2_ui(), gtk_ui, ui_host, this, features_dst); - slv2_value_free(gtk_ui); - slv2_ui_host_free(ui_host); + _lv2->slv2_plugin(), _lv2->slv2_ui(), ui_GtkUI, ui_host, this, features_dst); #else _inst = slv2_ui_instantiate( _lv2->slv2_plugin(), _lv2->slv2_ui(), LV2PluginUI::lv2_ui_write, this, diff --git a/gtk2_ardour/lv2_plugin_ui.h b/gtk2_ardour/lv2_plugin_ui.h index ec2f00360f..158c7cb2e0 100644 --- a/gtk2_ardour/lv2_plugin_ui.h +++ b/gtk2_ardour/lv2_plugin_ui.h @@ -80,6 +80,7 @@ class LV2PluginUI : public PlugUIBase, public Gtk::VBox #ifdef HAVE_NEW_SLV2 static SLV2UIHost ui_host; + static SLV2Value ui_GtkUI; #endif static void lv2_ui_write(