From e1095310a8186bbd977534285df0ab29423d3aa3 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 6 Mar 2017 23:49:40 +0100 Subject: Rework VST initialization: Set the AEffect* plugin pointer before calling effOpen. effOpen may call back into the host (masterCallback) and invoke actions which depend on _plugin (eg. to call back into the plugin again) --- libs/ardour/windows_vst_plugin.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libs/ardour/windows_vst_plugin.cc') diff --git a/libs/ardour/windows_vst_plugin.cc b/libs/ardour/windows_vst_plugin.cc index 53bfee05e8..82304a9f93 100644 --- a/libs/ardour/windows_vst_plugin.cc +++ b/libs/ardour/windows_vst_plugin.cc @@ -39,9 +39,10 @@ WindowsVSTPlugin::WindowsVSTPlugin (AudioEngine& e, Session& session, VSTHandle* if ((_state = fst_instantiate (_handle, Session::vst_callback, this)) == 0) { throw failed_constructor(); } + open_plugin (); Session::vst_current_loading_id = 0; - set_plugin (_state->plugin); + init_plugin (); } WindowsVSTPlugin::WindowsVSTPlugin (const WindowsVSTPlugin &other) @@ -53,17 +54,16 @@ WindowsVSTPlugin::WindowsVSTPlugin (const WindowsVSTPlugin &other) if ((_state = fst_instantiate (_handle, Session::vst_callback, this)) == 0) { throw failed_constructor(); } + open_plugin (); Session::vst_current_loading_id = 0; - _plugin = _state->plugin; - XMLNode* root = new XMLNode (other.state_node_name ()); LocaleGuard lg; other.add_state (root); set_state (*root, Stateful::loading_state_version); delete root; - set_plugin (_state->plugin); + init_plugin (); } WindowsVSTPlugin::~WindowsVSTPlugin () -- cgit v1.2.3