mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-14 23:43:52 +02:00
Use atomic fetch-and-add for unique window classes
This commit is contained in:
@@ -379,13 +379,7 @@ intptr_t Vst2Bridge::dispatch_wrapper(AEffect* plugin,
|
||||
// provided by the host, and let the plugin embed itself into
|
||||
// the Wine window
|
||||
const auto x11_handle = reinterpret_cast<size_t>(data);
|
||||
// Win32 window classes have to be unique for the whole application.
|
||||
// When hosting multiple plugins in a group process, all plugins
|
||||
// should get a unique window class
|
||||
const std::string window_class =
|
||||
"yabridge plugin " + sockets.base_dir.string();
|
||||
Editor& editor_instance =
|
||||
editor.emplace(config, window_class, x11_handle);
|
||||
Editor& editor_instance = editor.emplace(config, x11_handle);
|
||||
|
||||
return plugin->dispatcher(plugin, opcode, index, value,
|
||||
editor_instance.get_win32_handle(),
|
||||
|
||||
@@ -397,9 +397,6 @@ void Vst3Bridge::run() {
|
||||
// and if it's actually needed (for instance when the host
|
||||
// resizes the window without informing the plugin)
|
||||
const auto x11_handle = static_cast<size_t>(request.parent);
|
||||
const std::string window_class =
|
||||
"yabridge plugin " + sockets.base_dir.string() + " " +
|
||||
std::to_string(request.owner_instance_id);
|
||||
|
||||
// Creating the window and having the plugin embed in it should
|
||||
// be done in the main UI thread
|
||||
@@ -407,8 +404,7 @@ void Vst3Bridge::run() {
|
||||
.run_in_context<tresult>([&]() {
|
||||
Editor& editor_instance =
|
||||
object_instances[request.owner_instance_id]
|
||||
.editor.emplace(config, window_class,
|
||||
x11_handle);
|
||||
.editor.emplace(config, x11_handle);
|
||||
|
||||
const tresult result =
|
||||
object_instances[request.owner_instance_id]
|
||||
|
||||
Reference in New Issue
Block a user