Fix T91507: Crash when calling context menu from confirmation popup

A typical issue with popup handling: We have to respect the menu-region
and give it priority over the regular region for handling. In this case
there isn't a regular region in context even.
This commit is contained in:
2021-11-01 16:30:40 +01:00
parent c0fbbc53e8
commit 06b183d1ca

View File

@@ -926,7 +926,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev
}
{
const ARegion *region = CTX_wm_region(C);
const ARegion *region = CTX_wm_menu(C) ? CTX_wm_menu(C) : CTX_wm_region(C);
uiButTreeRow *treerow_but = (uiButTreeRow *)ui_tree_row_find_mouse_over(region, event->xy);
if (treerow_but) {
BLI_assert(treerow_but->but.type == UI_BTYPE_TREEROW);
@@ -1212,7 +1212,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev
}
/* UI List item context menu. Scripts can add items to it, by default there's nothing shown. */
ARegion *region = CTX_wm_region(C);
const ARegion *region = CTX_wm_menu(C) ? CTX_wm_menu(C) : CTX_wm_region(C);
const bool is_inside_listbox = ui_list_find_mouse_over(region, event) != NULL;
const bool is_inside_listrow = is_inside_listbox ?
ui_list_row_find_mouse_over(region, event->xy) != NULL :