Make lv2ui_instantiate and lv2ui_free a little more symmetrical, so that there aren't GTK errors on reopening a LV2 plugin UI because of trying to repack already packed widgets (#4733).

git-svn-id: svn://localhost/ardour2/branches/3.0@11589 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2012-03-04 21:45:51 +00:00
parent 22b583a8e7
commit 0e5abb0e4b
2 changed files with 20 additions and 11 deletions

View File

@ -151,6 +151,7 @@ LV2PluginUI::LV2PluginUI(boost::shared_ptr<PluginInsert> pi,
: PlugUIBase(pi)
, _lv2(lv2p)
, _gui_widget(NULL)
, _ardour_buttons_box(NULL)
, _values(NULL)
, _external_ui_ptr(NULL)
, _inst(NULL)
@ -228,17 +229,17 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title)
_external_ui_ptr = NULL;
if (_inst) {
if (!is_external_ui) {
Gtk::HBox* box = manage (new Gtk::HBox);
box->set_spacing (6);
box->set_border_width (6);
box->pack_end (focus_button, false, false);
box->pack_end (bypass_button, false, false, 10);
box->pack_end (delete_button, false, false);
box->pack_end (save_button, false, false);
box->pack_end (add_button, false, false);
box->pack_end (_preset_combo, false, false);
box->show_all();
pack_start(*box, false, false);
_ardour_buttons_box = manage (new Gtk::HBox);
_ardour_buttons_box->set_spacing (6);
_ardour_buttons_box->set_border_width (6);
_ardour_buttons_box->pack_end (focus_button, false, false);
_ardour_buttons_box->pack_end (bypass_button, false, false, 10);
_ardour_buttons_box->pack_end (delete_button, false, false);
_ardour_buttons_box->pack_end (save_button, false, false);
_ardour_buttons_box->pack_end (add_button, false, false);
_ardour_buttons_box->pack_end (_preset_combo, false, false);
_ardour_buttons_box->show_all();
pack_start(*_ardour_buttons_box, false, false);
GtkWidget* c_widget = (GtkWidget*)GET_WIDGET(_inst);
_gui_widget = Glib::wrap(c_widget);
@ -281,6 +282,12 @@ LV2PluginUI::lv2ui_free()
remove (*_gui_widget);
}
if (_ardour_buttons_box) {
remove (*_ardour_buttons_box);
delete _ardour_buttons_box;
_ardour_buttons_box = 0;
}
suil_instance_free((SuilInstance*)_inst);
_inst = NULL;

View File

@ -68,6 +68,8 @@ class LV2PluginUI : public PlugUIBase, public Gtk::VBox
std::vector<int> _output_ports;
sigc::connection _screen_update_connection;
Gtk::Widget* _gui_widget;
/** a box containing the focus, bypass, delete, save / add preset buttons etc. */
Gtk::HBox* _ardour_buttons_box;
float* _values;
std::vector<ControllableRef> _controllables;
struct lv2_external_ui_host _external_ui_host;