From cebc307542b2d0b0c3545fd479c21f4a32c08338 Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 19 May 2020 02:27:28 +0100 Subject: [PATCH] Fix for vst2 plugins that crash on init Signed-off-by: falkTX --- source/backend/plugin/CarlaPluginVST2.cpp | 11 ++++++++--- source/utils/CarlaProcessUtils.cpp | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/source/backend/plugin/CarlaPluginVST2.cpp b/source/backend/plugin/CarlaPluginVST2.cpp index ef237af5d..ebd0e7e79 100644 --- a/source/backend/plugin/CarlaPluginVST2.cpp +++ b/source/backend/plugin/CarlaPluginVST2.cpp @@ -24,6 +24,7 @@ #include "CarlaBackendUtils.hpp" #include "CarlaMathUtils.hpp" +#include "CarlaProcessUtils.hpp" #include "CarlaScopeUtils.hpp" #include "CarlaVstUtils.hpp" @@ -2418,9 +2419,13 @@ public: sCurrentUniqueId = static_cast(uniqueId); sLastCarlaPluginVST2 = this; - try { - fEffect = vstFn(carla_vst_audioMasterCallback); - } CARLA_SAFE_EXCEPTION_RETURN("Vst init", false); + { + const ScopedAbortCatcher sac; + + try { + fEffect = vstFn(carla_vst_audioMasterCallback); + } CARLA_SAFE_EXCEPTION_RETURN("Vst init", false); + } sLastCarlaPluginVST2 = nullptr; sCurrentUniqueId = 0; diff --git a/source/utils/CarlaProcessUtils.cpp b/source/utils/CarlaProcessUtils.cpp index 3d609c60f..b50535300 100644 --- a/source/utils/CarlaProcessUtils.cpp +++ b/source/utils/CarlaProcessUtils.cpp @@ -33,7 +33,7 @@ ScopedAbortCatcher::ScopedAbortCatcher() ScopedAbortCatcher::~ScopedAbortCatcher() { #ifndef CARLA_OS_WIN - if (! s_triggered) + if (s_oldsig != nullptr && ! s_triggered) std::signal(SIGABRT, s_oldsig); #endif }