From db02fa1c43e4259ae869c49fe3b1480a24ba4309 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 22 Oct 2020 14:05:59 +0200 Subject: [PATCH] Fix issue with closing sockets in plugin groups As per Boost.Asio's manual, an explicit `socket.shutdown()` is needed before calling `close()`. For some reason this worked fine in almost every situation, but when hosting both a plugin hosted within a group host process and a normal individually hosted plugin within a single process, and then removing those two plugins in order, the `host_vst_dispatch` socket of the first plugin never got closed. This would hang the entire shutdown sequence to hang on the `dispatch_handler` jthread. First discovered in #45 --- CHANGELOG.md | 3 +++ src/plugin/host-process.cpp | 2 ++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0049e58..e463d458 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ Versioning](https://semver.org/spec/v2.0.0.html). errors and crash yabridge. - Fixed a regression where certain fake dropdown menus such as those used in the Tokyo Dawn Records plugins would close immediately when hovering over them. +- Fixed an issue where plugins hosted within a plugin group would not shut down + properly in certain situations. This would cause the VST host to hang while + removing such a plugin. ### yabridgectl diff --git a/src/plugin/host-process.cpp b/src/plugin/host-process.cpp index 32cf8c82..83d78c23 100644 --- a/src/plugin/host-process.cpp +++ b/src/plugin/host-process.cpp @@ -262,5 +262,7 @@ void GroupHost::terminate() { // There's no need to manually terminate group host processes as they will // shut down automatically after all plugins have exited. Manually closing // the dispatch socket will cause the associated plugin to exit. + host_vst_dispatch.shutdown( + boost::asio::local::stream_protocol::socket::shutdown_both); host_vst_dispatch.close(); }