From e283df51710cd2267d3284cf22e932b032b5499d Mon Sep 17 00:00:00 2001 From: David Schornsheim Date: Mon, 26 Feb 2024 17:36:47 +0100 Subject: [PATCH] Add crash safeguards against incorrect VST3 calling sequences --- src/wrapasvst3.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/wrapasvst3.cpp b/src/wrapasvst3.cpp index b6790da9..153eed40 100644 --- a/src/wrapasvst3.cpp +++ b/src/wrapasvst3.cpp @@ -59,6 +59,10 @@ tresult PLUGIN_API ClapAsVst3::terminate() if (_plugin) { _os_attached.off(); // ensure we are detached + if (_active) + { + _plugin->deactivate(); + } _plugin->terminate(); _plugin.reset(); } @@ -111,6 +115,11 @@ tresult PLUGIN_API ClapAsVst3::setActive(TBool state) tresult PLUGIN_API ClapAsVst3::process(Vst::ProcessData& data) { + if (!_active || !_processing) + { + return kNotInitialized; + } + auto thisFn = _plugin->AlwaysAudioThread(); this->_processAdapter->process(data); return kResultOk;