From 4d7eb04cf6f2857955528b6e24e7b6f5e21fc7d4 Mon Sep 17 00:00:00 2001 From: John Emmas Date: Sun, 28 Aug 2016 10:26:02 +0100 Subject: [PATCH] Fix a crash when toggling back and forth between a generic plugin GUI window and a VST plugin's own GUI --- gtk2_ardour/windows_vst_plugin_ui.cc | 2 ++ libs/fst/vstwin.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/gtk2_ardour/windows_vst_plugin_ui.cc b/gtk2_ardour/windows_vst_plugin_ui.cc index 5281890963..7f14819986 100644 --- a/gtk2_ardour/windows_vst_plugin_ui.cc +++ b/gtk2_ardour/windows_vst_plugin_ui.cc @@ -58,6 +58,8 @@ WindowsVSTPluginUI::WindowsVSTPluginUI (boost::shared_ptr pi, boos WindowsVSTPluginUI::~WindowsVSTPluginUI () { + fst_destroy_editor (_vst->state()); + // plugin destructor destroys the custom GUI, via Windows fun-and-games, // and then our PluginUIWindow does the rest } diff --git a/libs/fst/vstwin.c b/libs/fst/vstwin.c index 3a1f624934..ba3187684b 100644 --- a/libs/fst/vstwin.c +++ b/libs/fst/vstwin.c @@ -374,6 +374,9 @@ fst_exit (void) int fst_run_editor (VSTState* fst, void* window_parent) { + /* For safety, remove any pre-existing editor window */ + fst_destroy_editor (fst); + if (fst->windows_window == NULL) { HMODULE hInst; HWND window;