Handle mutual recursion while loading presets

This commit is contained in:
Robbert van der Helm
2021-04-29 23:09:20 +02:00
parent 74dd7f61a2
commit cb07fd07a2
2 changed files with 16 additions and 14 deletions
+2
View File
@@ -81,6 +81,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
- Fixed the VST3 version of _W. A. Production ImPerfect_ from crashing during - Fixed the VST3 version of _W. A. Production ImPerfect_ from crashing during
audio setup. audio setup.
- Fixed _UVI Plugsound Free_ crashing during initialization. - Fixed _UVI Plugsound Free_ crashing during initialization.
- Fixed a rare potential freeze when loading a VST3 plugin preset while the
plugin is being resized.
- Because of the new transport information prefetching, the excessive DSP usage - Because of the new transport information prefetching, the excessive DSP usage
in _SWAM Cello_ is now been fixed without requiring any manual compatibility in _SWAM Cello_ is now been fixed without requiring any manual compatibility
options. options.
+14 -14
View File
@@ -234,20 +234,20 @@ void Vst3Bridge::run() {
-> Vst3PluginProxy::SetState::Response { -> Vst3PluginProxy::SetState::Response {
// We need to run `getState()` from the main thread, so we might // We need to run `getState()` from the main thread, so we might
// as well do the same thing with `setState()`. See below. // as well do the same thing with `setState()`. See below.
return main_context // NOTE: We also try to handle mutual recursion here, in case
.run_in_context<tresult>([&]() { // this happens during a resize
// This same function is defined in both `IComponent` return do_mutual_recursion_on_gui_thread<tresult>([&]() {
// and `IEditController`, so the host is calling one or // This same function is defined in both `IComponent` and
// the other // `IEditController`, so the host is calling one or the
if (object_instances[request.instance_id].component) { // other
return object_instances[request.instance_id] if (object_instances[request.instance_id].component) {
.component->setState(&request.state); return object_instances[request.instance_id]
} else { .component->setState(&request.state);
return object_instances[request.instance_id] } else {
.edit_controller->setState(&request.state); return object_instances[request.instance_id]
} .edit_controller->setState(&request.state);
}) }
.get(); });
}, },
[&](Vst3PluginProxy::GetState& request) [&](Vst3PluginProxy::GetState& request)
-> Vst3PluginProxy::GetState::Response { -> Vst3PluginProxy::GetState::Response {