diff --git a/README.md b/README.md index d2c4c15b..7f539ab3 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,6 @@ There are a few things that should be done before making this public, including: - Implement missing features: - GUIs. Right now I'm just ignoring all of the opcodes related to GUIs so that the plugins don't crash when you open their GUI. - - The Wine process seems to segfault on shutdown even though it doesn't seem - to cause any other problems. This can probably be fixed by catching - exceptions thrown in the threads caused by sockets being closed. It's - handled similarly in the native VST plugin. - The initial host callback fails in Bitwig if the plugin is bridged, but it works if it's directly loaded into Bitwig. - Check whether sidechaining and MPE work since they're unofficial additions diff --git a/src/plugin/host-bridge.cpp b/src/plugin/host-bridge.cpp index 3e0f6cc9..8bf42612 100644 --- a/src/plugin/host-bridge.cpp +++ b/src/plugin/host-bridge.cpp @@ -117,18 +117,15 @@ HostBridge::HostBridge(audioMasterCallback host_callback) // instead of asynchronous IO since communication has to be handled in // lockstep anyway host_callback_handler = std::thread([&]() { - while (true) { - try { + try { + while (true) { passthrough_event(vst_host_callback, &plugin, host_callback_function, std::pair(logger, false)); - } catch (const boost::system::system_error&) { - // TODO: This raises SIBABRT if not caught, fix similar issues - // in the Wine VST host - // This happens when the sockets got closed because the plugin - // is being shut down - break; } + } catch (const boost::system::system_error&) { + // This happens when the sockets got closed because the plugin + // is being shut down } }); @@ -236,14 +233,20 @@ intptr_t HostBridge::dispatch(AEffect* /*plugin*/, // correctly // Allow the plugin to handle its own shutdown - // TODO: Seems to cause segfaults in the Wine process, but doesn't - // seem to cause noticable problems const auto return_value = send_event( host_vst_dispatch, converter, opcode, index, value, data, option, std::pair(logger, true)); - // XXX: Boost.Process will send SIGKILL to the process for us, is - // there a way to manually send a SIGTERM signal instead? + // Boost.Process will send SIGKILL to the Wien host for us when this + // class gets destroyed. Because the process is running a few + // threads Wine will say something about a segfault (probably + // related to `std::terminate`), but this doesn't seem to have any + // negative impact + + // The `stop()` method will cause the IO context to just drop all of + // its work and immediately and not throw any exceptions that would + // have been caused by pipes and sockets being closed + io_context.stop(); // `std::thread`s are not interruptable, and since we're doing // blocking synchronous reads there's no way to interrupt them. If @@ -255,11 +258,6 @@ intptr_t HostBridge::dispatch(AEffect* /*plugin*/, host_callback_handler.detach(); wine_io_handler.detach(); - // The `stop()` method will cause the IO context to just drop all of - // its work and immediately and not throw any exceptions that would - // have been caused by pipes and sockets being closed - io_context.stop(); - delete this; return return_value;