Fix #125006: crash confirming specific operator popup dialog with ENTER

Crash was happening in this scenario:
- mouse was over a property in the dialog
- operator had a "check" callback that was accessing certain operator
stuff

In this case, the `UI_BUT_ACTIVE_DEFAULT` button was executed, operator
finished or canceled (but stuff was freed along the way), then code
kicked in to still handle ENTER over the property in the popup (e.g.
toggle a checkbox), the `uiAfterFunc` still had the `popup_op`, tried to
run `popup_check` again with the faulty data.

Simple way to fix this is to use `WM_UI_HANDLER_BREAK` to not handle
further buttons after executing the `UI_BUT_ACTIVE_DEFAULT`

Pull Request: https://projects.blender.org/blender/blender/pulls/125085
This commit is contained in:
Philipp Oeser
2024-07-22 11:43:06 +02:00
committed by Philipp Oeser
parent 73338c1553
commit d5d64f4a9f

View File

@@ -11105,6 +11105,7 @@ static int ui_handle_menu_event(bContext *C,
if ((but_default != nullptr) && (but_default->active == nullptr)) {
if (but_default->type == UI_BTYPE_BUT) {
UI_but_execute(C, region, but_default);
retval = WM_UI_HANDLER_BREAK;
}
else {
ui_handle_button_activate_by_type(C, region, but_default);