From 7b19769a6504a45eec158bf362dfe15f3e8653c9 Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Sat, 18 May 2024 17:58:18 +0200 Subject: [PATCH] fix vst3 for plugins without ui --- templates/vst3/src/vst3.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/vst3/src/vst3.c b/templates/vst3/src/vst3.c index 42c530a..7091e6f 100644 --- a/templates/vst3/src/vst3.c +++ b/templates/vst3/src/vst3.c @@ -1249,12 +1249,14 @@ static Steinberg_uint32 controllerRelease(controller *c) { c->refs--; if (c->refs == 0) { TRACE(" free %p\n", (void *)c); +#ifdef PLUGIN_UI if (c->views) { for (size_t i = 0; i < c->viewsCount; i++) if (c->views[i]) // this should not happen but you never know plugViewRelease(c->views[i]); free(c->views); } +#endif free(c); return 0; } @@ -1822,8 +1824,10 @@ static Steinberg_tresult factoryCreateInstance(void *thisInterface, Steinberg_FI c->refs = 1; c->context = NULL; c->componentHandler = NULL; +#ifdef PLUGIN_UI c->views = NULL; c->viewsCount = 0; +#endif *obj = c; TRACE(" instance: %p\n", (void *)c); } else {