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/fst/vstwin.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'libs/fst') diff --git a/libs/fst/vstwin.c b/libs/fst/vstwin.c index ec2f290cce..0668bbf033 100644 --- a/libs/fst/vstwin.c +++ b/libs/fst/vstwin.c @@ -550,8 +550,16 @@ fst_instantiate (VSTHandle* fhandle, audioMasterCallback amc, void* userptr) return NULL; } - fst->plugin->dispatcher (fst->plugin, effOpen, 0, 0, 0, 0); - fst->vst_version = fst->plugin->dispatcher (fst->plugin, effGetVstVersion, 0, 0, 0, 0); + if (!userptr) { + /* scanning.. or w/o master-callback userptr == 0, open now. + * + * Session::vst_callback needs a pointer to the AEffect + * ((VSTPlugin*)userptr)->_plugin = vstfx->plugin + * before calling effOpen, because effOpen may call back + */ + fst->plugin->dispatcher (fst->plugin, effOpen, 0, 0, 0, 0); + fst->vst_version = fst->plugin->dispatcher (fst->plugin, effGetVstVersion, 0, 0, 0, 0); + } fst->handle->plugincnt++; fst->wantIdle = 0; -- cgit v1.2.3