Revert "Work around a memory corruption issue on unload"

This reverts commit 0c047f9a66.

This workaround was needed because of the weird threading behavior with
the Win32 APIs, std::thread and winelib. Now that the actual
`active_plugins.erase()` call is done from within the plugin
context/main thread, this hack is no longer needed.
This commit is contained in:
Robbert van der Helm
2020-05-29 11:24:56 +02:00
parent 4dcc8fd97f
commit 890e5b736b
2 changed files with 7 additions and 18 deletions
+4 -6
View File
@@ -69,10 +69,7 @@ Vst2Bridge::Vst2Bridge(boost::asio::io_context& main_context,
std::string plugin_dll_path,
std::string socket_endpoint_path)
: io_context(main_context),
// See `plugin_handle`s docstring for information on why we're leaking
// memory here
// plugin_handle(LoadLibrary(plugin_dll_path.c_str()), FreeLibrary),
plugin_handle(LoadLibrary(plugin_dll_path.c_str())),
plugin_handle(LoadLibrary(plugin_dll_path.c_str()), FreeLibrary),
socket_endpoint(socket_endpoint_path),
host_vst_dispatch(io_context),
host_vst_dispatch_midi_events(io_context),
@@ -89,8 +86,9 @@ Vst2Bridge::Vst2Bridge(boost::asio::io_context& main_context,
// there are some older deprecated names that legacy plugins may still use
VstEntryPoint vst_entry_point = nullptr;
for (auto name : {"VSTPluginMain", "main_plugin", "main"}) {
vst_entry_point = reinterpret_cast<VstEntryPoint>(
reinterpret_cast<size_t>(GetProcAddress(plugin_handle, name)));
vst_entry_point =
reinterpret_cast<VstEntryPoint>(reinterpret_cast<size_t>(
GetProcAddress(plugin_handle.get(), name)));
if (vst_entry_point != nullptr) {
break;