Fix crash when closing LV2 UIs.
[ardour.git] / gtk2_ardour / lv2_plugin_ui.cc
index 7699f394d0ee23ba7da9e414efcccf5ff82c928f..cacc24af66762ab965181e1579b8a2de326fb09f 100644 (file)
@@ -310,18 +310,18 @@ LV2PluginUI::lv2ui_free()
 
        if (_gui_widget) {
                remove (*_gui_widget);
+               _gui_widget = NULL;
        }
 
        if (_ardour_buttons_box) {
                remove (*_ardour_buttons_box);
-               delete _ardour_buttons_box;
-               _ardour_buttons_box = 0;
+               _ardour_buttons_box = NULL;
        }
 
-       suil_instance_free((SuilInstance*)_inst);
-
-       _inst = NULL;
-       _gui_widget = NULL;
+       if (_inst) {
+               suil_instance_free((SuilInstance*)_inst);
+               _inst = NULL;
+       }
 }
 
 LV2PluginUI::~LV2PluginUI ()