diff --git a/src/wine-host/bridges/common.h b/src/wine-host/bridges/common.h index 90a17128..33de6f6a 100644 --- a/src/wine-host/bridges/common.h +++ b/src/wine-host/bridges/common.h @@ -102,6 +102,14 @@ class HostBridge { const boost::filesystem::path plugin_path; protected: + /** + * Used as part of the watchdog that shuts down a plugin when the remote + * native host process dies. This is used to prevent plugins from hanging + * indefinitely on a `recv()`. This function should just call + * `sockets.close()`. + */ + virtual void close_sockets() = 0; + /** * The IO context used for event handling so that all events and window * message handling can be performed from a single thread, even when hosting diff --git a/src/wine-host/bridges/vst2.cpp b/src/wine-host/bridges/vst2.cpp index 3f5c772b..06c78b0c 100644 --- a/src/wine-host/bridges/vst2.cpp +++ b/src/wine-host/bridges/vst2.cpp @@ -425,6 +425,10 @@ void Vst2Bridge::handle_x11_events() { } } +void Vst2Bridge::close_sockets() { + sockets.close(); +} + intptr_t Vst2Bridge::dispatch_wrapper(AEffect* plugin, int opcode, int index, diff --git a/src/wine-host/bridges/vst2.h b/src/wine-host/bridges/vst2.h index 399c6595..426e4262 100644 --- a/src/wine-host/bridges/vst2.h +++ b/src/wine-host/bridges/vst2.h @@ -68,6 +68,10 @@ class Vst2Bridge : public HostBridge { void handle_x11_events() override; + protected: + void close_sockets() override; + + public: /** * Forward the host callback made by the plugin to the host and return the * results. diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index b6e83e53..96985e32 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -1133,6 +1133,10 @@ void Vst3Bridge::handle_x11_events() { } } +void Vst3Bridge::close_sockets() { + sockets.close(); +} + void Vst3Bridge::register_context_menu(Vst3ContextMenuProxyImpl& context_menu) { std::lock_guard lock(object_instances[context_menu.owner_instance_id()] .registered_context_menus_mutex); diff --git a/src/wine-host/bridges/vst3.h b/src/wine-host/bridges/vst3.h index 3a610df5..f9505f78 100644 --- a/src/wine-host/bridges/vst3.h +++ b/src/wine-host/bridges/vst3.h @@ -233,6 +233,10 @@ class Vst3Bridge : public HostBridge { void handle_x11_events() override; + protected: + void close_sockets() override; + + public: /** * Send a callback message to the host return the response. This is a * shorthand for `sockets.vst_host_callback.send_message` for use in VST3