Fix mutual recursion with latency in Ardour/Mixbus

This would cause Ardour and Mixbus to freeze when inserting a latency
introducing (JUCE based) VST3 plugin. As mentioned in #98.
This commit is contained in:
Robbert van der Helm
2021-04-29 03:09:42 +02:00
parent 22f94dd22f
commit 8b168b310c
4 changed files with 49 additions and 4 deletions
+16 -2
View File
@@ -1300,8 +1300,22 @@ size_t Vst3Bridge::register_object_instance(
},
[&](const YaComponent::SetActive& request)
-> YaComponent::SetActive::Response {
return object_instances[request.instance_id]
.component->setActive(request.state);
// NOTE: Ardour/Mixbus will immediately call this
// function in response to a latency change
// announced through
// `IComponentHandler::restartComponent()`. We
// need to make sure that these two functions are
// handled from the same thread to prevent
// deadlocks caused by mutually recursive function
// calls.
// TODO: Check if this causes any issues when activating
// plugins while simultaneously resizing another
// instance of the same plugin
return do_mutual_recursion_or_handle_in_main_context<
tresult>([&]() {
return object_instances[request.instance_id]
.component->setActive(request.state);
});
},
[&](const YaPrefetchableSupport::GetPrefetchableSupport&
request)