{
//cout << "stop_updating" << endl;
- if ( //!_external_ui_ptr &&
- !_output_ports.empty()) {
+ if (!_output_ports.empty()) {
_screen_update_connection.disconnect();
}
return false;
boost::shared_ptr<LV2Plugin> lv2p)
: PlugUIBase(pi)
, _lv2(lv2p)
+ , _gui_widget(NULL)
, _values(NULL)
, _external_ui_ptr(NULL)
, _inst(NULL)
{
- if (!_lv2->is_external_ui()) {
- lv2ui_instantiate("gtk2gui");
- }
}
void
}
}
-LV2PluginUI::~LV2PluginUI ()
+void
+LV2PluginUI::lv2ui_free()
{
- //cout << "LV2PluginUI destructor called" << endl;
-
- if (_values) {
- delete[] _values;
+ if (_lv2->is_external_ui() || !_gui_widget) {
+ return;
}
- /* Close and delete GUI. */
+ stop_updating(NULL);
+ remove(*_gui_widget);
+
#ifdef HAVE_SUIL
suil_instance_free((SuilInstance*)_inst);
#else
}
#endif
+ _inst = NULL;
+ _gui_widget = NULL;
+}
+
+LV2PluginUI::~LV2PluginUI ()
+{
+ //cout << "LV2PluginUI destructor called" << endl;
+
+ if (_values) {
+ delete[] _values;
+ }
+
+ /* Close and delete GUI. */
+ lv2ui_free();
+
_screen_update_connection.disconnect();
if (_lv2->is_external_ui()) {
_screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect
(sigc::mem_fun(*this, &LV2PluginUI::output_update));
return false;
+ } else {
+ lv2ui_instantiate("gtk2gui");
}
return true;
//slv2_ui_instance_get_descriptor(_inst)->cleanup(_inst);
//_external_ui_ptr = NULL;
//_screen_update_connection.disconnect();
+ } else {
+ lv2ui_free();
}
}