From a01319e5076e5dad662c2cc118e064d8ff308524 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 16 Mar 2020 14:14:55 +0100 Subject: [PATCH] Allow plugins to crash during shutdown Sounds weird, but there are a small number of plugins that crash during shutdown because they call functions not yet supported by Wine. Since the host will have already saved all state before calling `effClose` this should not cause any problems. --- src/plugin/host-bridge.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/plugin/host-bridge.cpp b/src/plugin/host-bridge.cpp index 0a987ccd..7ecf2418 100644 --- a/src/plugin/host-bridge.cpp +++ b/src/plugin/host-bridge.cpp @@ -260,10 +260,23 @@ intptr_t HostBridge::dispatch(AEffect* /*plugin*/, // TODO: Check whether the sockets and the endpoint are closed // correctly - // Allow the plugin to handle its own shutdown - const auto return_value = send_event( - host_vst_dispatch, dispatch_semaphore, converter, opcode, index, - value, data, option, std::pair(logger, true)); + // Allow the plugin to handle its own shutdown. I've found a few + // plugins that work fine except for that they crash during + // shutdown. This shouldn't have any negative side effects since + // state has already been saved before this and all resources are + // cleaned up properly. Still not sure if this is a good way to + // handle this. + intptr_t return_value = 1; + try { + return_value = + send_event(host_vst_dispatch, dispatch_semaphore, converter, + opcode, index, value, data, option, + std::pair(logger, true)); + } catch (const boost::system::system_error& a) { + // Thrown when the socket gets closed because the VST plugin + // loaded into the Wine process crashed during shutdown + logger.log("The plugin crashed during shutdown, ignoring"); + } // Boost.Process will send SIGKILL to the Wien host for us when this // class gets destroyed. Because the process is running a few