Handle mutual recursion in context menus

REAPER will call `getState()` while the context menu is open, and that
also has to be handled from the GUI thread.
This commit is contained in:
Robbert van der Helm
2021-04-30 02:49:54 +02:00
parent 52428c8749
commit 36b3636072
3 changed files with 20 additions and 16 deletions
@@ -114,7 +114,10 @@ tresult PLUGIN_API Vst3ContextMenuProxyImpl::removeItem(
tresult PLUGIN_API Vst3ContextMenuProxyImpl::popup(Steinberg::UCoord x,
Steinberg::UCoord y) {
return bridge.send_message(
// NOTE: This requires mutual recursion, because REAPER will call
// `getState()` whle the context menu is open, and `getState()` also
// has to be handled from the GUi thread
return bridge.send_mutually_recursive_message(
YaContextMenu::Popup{.owner_instance_id = owner_instance_id(),
.context_menu_id = context_menu_id(),
.x = x,