free memory of external plugins on GUI close (major mem leak).
authorRobin Gareus <robin@gareus.org>
Sun, 25 Aug 2013 13:54:43 +0000 (15:54 +0200)
committerRobin Gareus <robin@gareus.org>
Sun, 25 Aug 2013 14:21:18 +0000 (16:21 +0200)
There is at least one known plugin that has a problem with this
(custom thread race condition) but it also crashes in other hosts:
http://www.drumgizmo.org/wiki/doku.php?id=bugs&do=showcaselink&showid=8&project=drumgizmo

tested to be working with various nedko, falktx and x42 plugins

gtk2_ardour/lv2_plugin_ui.cc

index f9b15714f6f835fe13a4ba2ea3b32a427ba93c29..6f22ce51827f1e74f6aaba5d86bbd01e562366a3 100644 (file)
@@ -116,6 +116,10 @@ LV2PluginUI::on_external_ui_closed(void* controller)
        LV2PluginUI* me = (LV2PluginUI*)controller;
        me->_screen_update_connection.disconnect();
        me->_external_ui_ptr = NULL;
+#if 1
+       suil_instance_free((SuilInstance*)me->_inst);
+       me->_inst = NULL;
+#endif
 }
 
 void
@@ -450,9 +454,12 @@ LV2PluginUI::on_window_hide()
 
        if (_external_ui_ptr) {
                LV2_EXTERNAL_UI_HIDE(_external_ui_ptr);
-               //slv2_ui_instance_get_descriptor(_inst)->cleanup(_inst);
-               //_external_ui_ptr = NULL;
-               //_screen_update_connection.disconnect();
+               _screen_update_connection.disconnect();
+               _external_ui_ptr = NULL;
+#if 1
+               suil_instance_free((SuilInstance*)_inst);
+               _inst = NULL;
+#endif
        } else {
                lv2ui_free();
        }