From abe925d0c67151ee1ecdae96a3d591ccc48381e9 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Mon, 6 Nov 2023 21:51:43 +0100 Subject: [PATCH] Fix #114436: Crash when right clicking certain, nested, popup dialogs `CTX_wm_region()` isn't reliable with popups. Handling should use `uiHandleButtonData.region` instead, which respects popup regions. --- source/blender/editors/interface/interface_handlers.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/interface/interface_handlers.cc b/source/blender/editors/interface/interface_handlers.cc index 0284ef5b700..9d35506430c 100644 --- a/source/blender/editors/interface/interface_handlers.cc +++ b/source/blender/editors/interface/interface_handlers.cc @@ -8047,16 +8047,15 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * (event->modifier & (KM_SHIFT | KM_CTRL | KM_ALT | KM_OSKEY)) == 0 && (event->val == KM_PRESS)) { - ARegion *region = CTX_wm_region(C); /* For some button types that are typically representing entire sets of data, right-clicking * to spawn the context menu should also activate the item. This makes it clear which item * will be operated on. * Apply the button immediately, so context menu polls get the right active item. */ uiBut *clicked_view_item_but = but->type == UI_BTYPE_VIEW_ITEM ? but : - ui_view_item_find_mouse_over(region, event->xy); + ui_view_item_find_mouse_over(data->region, event->xy); if (clicked_view_item_but) { - UI_but_execute(C, region, clicked_view_item_but); + UI_but_execute(C, data->region, clicked_view_item_but); } /* RMB has two options now */