From 1434f5855bb78fde907eb2114748df8952db0692 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 8 Mar 2020 17:59:47 +0100 Subject: [PATCH] Fix wine forward initialization order `io_context.run()` returns if there is no more work to do, so it should be called only after we give it something to do. --- src/plugin/host-bridge.cpp | 2 +- src/plugin/host-bridge.h | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugin/host-bridge.cpp b/src/plugin/host-bridge.cpp index c6efec31..2fdb9d53 100644 --- a/src/plugin/host-bridge.cpp +++ b/src/plugin/host-bridge.cpp @@ -124,11 +124,11 @@ HostBridge::HostBridge(audioMasterCallback host_callback) std::pair(logger, false)); } }); - wine_io_handler = std::thread([&]() { io_context.run(); }); // Print the Wine host's STDOUT and STDERR streams to the log file async_log_pipe_lines(wine_stdout, wine_stdout_buffer, "[Wine STDOUT] "); async_log_pipe_lines(wine_stderr, wine_stderr_buffer, "[Wine STDERR] "); + wine_io_handler = std::thread([&]() { io_context.run(); }); // Read the plugin's information from the Wine process. This can only be // done after we started accepting host callbacks as the plugin might do diff --git a/src/plugin/host-bridge.h b/src/plugin/host-bridge.h index cf8dc994..c4dc11f9 100644 --- a/src/plugin/host-bridge.h +++ b/src/plugin/host-bridge.h @@ -131,11 +131,6 @@ class HostBridge { * The thread that handles host callbacks. */ std::thread host_callback_handler; - /** - * Runs the Boost.Asio `io_context` thread for logging the Wine process - * STDOUT and STDERR messages. - */ - std::thread wine_io_handler; /** * The callback function passed by the host to the VST plugin instance. @@ -153,6 +148,12 @@ class HostBridge { * The STDERR stream of the Wine process we can forward to the logger. */ boost::process::async_pipe wine_stderr; + /** + * Runs the Boost.Asio `io_context` thread for logging the Wine process + * STDOUT and STDERR messages. + */ + std::thread wine_io_handler; + /** * The Wine process hosting the Windows VST plugin. */