From 7fb8cf97b15668689fc5860466fda21ae5cbdbfb Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 6 Dec 2020 14:47:19 +0100 Subject: [PATCH] Request factory after setting up callback handlers Otherwise we'll get a deadlock. --- src/plugin/bridges/vst3.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/plugin/bridges/vst3.cpp b/src/plugin/bridges/vst3.cpp index 1ac88ffb..167b7ede 100644 --- a/src/plugin/bridges/vst3.cpp +++ b/src/plugin/bridges/vst3.cpp @@ -70,13 +70,6 @@ Vst3PluginBridge::Vst3PluginBridge() // host connect_sockets_guarded(); - // Set up the plugin factory, since this is the first thing the host will - // request after loading the module - plugin_factory = std::make_unique(*this); - sockets.host_vst_control.receive_into( - WantsPluginFactory{}, *plugin_factory, - std::pair(logger, true)); - // Now that communication is set up the Wine host can send callbacks to this // bridge class, and we can send control messages to the Wine host. This // messaging mechanism is how we relay the VST3 communication protocol. As a @@ -93,4 +86,13 @@ Vst3PluginBridge::Vst3PluginBridge() request); }); }); + + // Set up the plugin factory, since this is the first thing the host will + // request after loading the module. Host callback handlers should have + // started before this since the Wine plugin host will request a copy of the + // configuration during its initialization. + plugin_factory = std::make_unique(*this); + sockets.host_vst_control.receive_into( + WantsPluginFactory{}, *plugin_factory, + std::pair(logger, true)); }