Also use mutual recursion for program list changes

The VST3 version of Voxengo TEOTE would deadlock in Ardour when Ardour
calls `IEditController::setState()`, the plugin calls
`IUnitHandler::notifyProgramListChange()` in response, and then when
Ardour calls `IUnitInfo::getProgramName()` while handling that callback.
All of these functions have to be called from the same thread in Voxengo
plugins.
This commit is contained in:
Robbert van der Helm
2021-05-02 00:38:14 +02:00
parent fd29c7d825
commit 5c88140c54
3 changed files with 19 additions and 7 deletions
@@ -175,10 +175,14 @@ tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::notifyUnitSelection(
tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::notifyProgramListChange(
Steinberg::Vst::ProgramListID listId,
int32 programIndex) {
return bridge.send_message(YaUnitHandler::NotifyProgramListChange{
.owner_instance_id = owner_instance_id(),
.list_id = listId,
.program_index = programIndex});
// NOTE: When a plugin calls this, Ardour will fetch the new program names
// with `IUnitInfo::getProgramName()`. TEOTE requires this to be
// called from the same thread.
return bridge.send_mutually_recursive_message(
YaUnitHandler::NotifyProgramListChange{
.owner_instance_id = owner_instance_id(),
.list_id = listId,
.program_index = programIndex});
}
tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::notifyUnitByBusChange() {