From 1746fce7e396eba12800474499b6d3a87b13b817 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Fri, 29 May 2020 11:28:19 +0200 Subject: [PATCH] Clarify group host plugin removal process better --- src/wine-host/bridges/group.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wine-host/bridges/group.cpp b/src/wine-host/bridges/group.cpp index 66ccbae0..0e1e2bc7 100644 --- a/src/wine-host/bridges/group.cpp +++ b/src/wine-host/bridges/group.cpp @@ -121,9 +121,11 @@ void GroupBridge::handle_plugin_dispatch(const GroupRequest request) { logger.log("'" + request.plugin_path + "' has exited"); // After the plugin has exited we'll remove this thread's plugin from the - // active plugins. This is done within the IO context so we can properly - // join the thread again. If no active plugins remain, then we'll terminate - // the process. + // active plugins. This is done within the IO context because the call to + // `FreeLibrary()` has to be done from the main thread, or else we'll + // potentially corrupt our heap. This way we can also properly join the + // thread again. If no active plugins remain, then we'll terminate the + // process. boost::asio::post(plugin_context, [&, request]() { std::lock_guard lock(active_plugins_mutex);