From bda9a0b75fdf12d9c7410ee95c077e97e5900539 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 1 May 2021 17:56:42 +0200 Subject: [PATCH] Catch exceptions in failing host callbacks This will let us more or less gracefully handle failing host callbacks during initialization. We cannot catch this from anywhere else since this these functions get called from unmanaged code. --- src/wine-host/bridges/vst2.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/wine-host/bridges/vst2.cpp b/src/wine-host/bridges/vst2.cpp index 2273be39..916fe081 100644 --- a/src/wine-host/bridges/vst2.cpp +++ b/src/wine-host/bridges/vst2.cpp @@ -657,6 +657,13 @@ intptr_t VST_CALL_CONV host_callback_proxy(AEffect* effect, intptr_t value, void* data, float option) { - return get_bridge_instance(effect).host_callback(effect, opcode, index, - value, data, option); + try { + return get_bridge_instance(effect).host_callback(effect, opcode, index, + value, data, option); + } catch (const boost::system::system_error& error) { + std::cerr << "Error while handling callback:" << std::endl; + std::cerr << error.what() << std::endl; + + return -1; + } }