mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +02:00
Construct and destruct IPlugView from GUI thread
This commit is contained in:
@@ -66,9 +66,15 @@ void Vst3Bridge::run() {
|
|||||||
overload{
|
overload{
|
||||||
[&](const Vst3PlugViewProxy::Destruct& request)
|
[&](const Vst3PlugViewProxy::Destruct& request)
|
||||||
-> Vst3PlugViewProxy::Destruct::Response {
|
-> Vst3PlugViewProxy::Destruct::Response {
|
||||||
// When the pointer gets dropped by the host, we want to drop it
|
// XXX: Not sure if his has to be run form the UI thread
|
||||||
// here as well
|
main_context
|
||||||
object_instances[request.owner_instance_id].plug_view.reset();
|
.run_in_context([&]() {
|
||||||
|
// When the pointer gets dropped by the host, we want to
|
||||||
|
// drop it here as well
|
||||||
|
object_instances[request.owner_instance_id]
|
||||||
|
.plug_view.reset();
|
||||||
|
})
|
||||||
|
.wait();
|
||||||
|
|
||||||
return Ack{};
|
return Ack{};
|
||||||
},
|
},
|
||||||
@@ -376,10 +382,16 @@ void Vst3Bridge::run() {
|
|||||||
},
|
},
|
||||||
[&](const YaEditController::CreateView& request)
|
[&](const YaEditController::CreateView& request)
|
||||||
-> YaEditController::CreateView::Response {
|
-> YaEditController::CreateView::Response {
|
||||||
object_instances[request.instance_id].plug_view =
|
// Instantiate the object from the GUI thread
|
||||||
Steinberg::owned(
|
main_context
|
||||||
object_instances[request.instance_id]
|
.run_in_context([&]() {
|
||||||
.edit_controller->createView(request.name.c_str()));
|
object_instances[request.instance_id].plug_view =
|
||||||
|
Steinberg::owned(
|
||||||
|
object_instances[request.instance_id]
|
||||||
|
.edit_controller->createView(
|
||||||
|
request.name.c_str()));
|
||||||
|
})
|
||||||
|
.wait();
|
||||||
|
|
||||||
// We'll create a proxy so the host can call functions on this
|
// We'll create a proxy so the host can call functions on this
|
||||||
// `IPlugView` object
|
// `IPlugView` object
|
||||||
|
|||||||
Reference in New Issue
Block a user