Fix T66246: Key accelerators crashing on save dialog
This commit is contained in:
parent
bbb3500c97
commit
26e05cf67a
Notes:
blender-bot
2023-02-14 09:29:42 +01:00
Referenced by issue #66246, Blender crashing on pressing the "D" / "S" keys on the save menu
|
@ -723,7 +723,7 @@ bool UI_block_active_only_flagged_buttons(const struct bContext *C,
|
|||
struct ARegion *ar,
|
||||
struct uiBlock *block);
|
||||
|
||||
void UI_but_execute(const struct bContext *C, uiBut *but);
|
||||
void UI_but_execute(const struct bContext *C, struct ARegion *ar, uiBut *but);
|
||||
|
||||
bool UI_but_online_manual_id(const uiBut *but,
|
||||
char *r_str,
|
||||
|
|
|
@ -896,9 +896,8 @@ bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *ar, uiBloc
|
|||
}
|
||||
|
||||
/* simulate button click */
|
||||
void UI_but_execute(const bContext *C, uiBut *but)
|
||||
void UI_but_execute(const bContext *C, ARegion *ar, uiBut *but)
|
||||
{
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
void *active_back;
|
||||
ui_but_execute_begin((bContext *)C, ar, but, &active_back);
|
||||
/* Value is applied in begin. No further action required. */
|
||||
|
|
|
@ -1347,7 +1347,7 @@ static bool ui_drag_toggle_set_xy_xy(
|
|||
/* is it pressed? */
|
||||
int pushed_state_but = ui_drag_toggle_but_pushed_state(C, but);
|
||||
if (pushed_state_but != pushed_state) {
|
||||
UI_but_execute(C, but);
|
||||
UI_but_execute(C, ar, but);
|
||||
if (do_check) {
|
||||
ui_but_update_edited(but);
|
||||
}
|
||||
|
@ -7939,6 +7939,8 @@ void ui_but_execute_begin(struct bContext *UNUSED(C),
|
|||
uiBut *but,
|
||||
void **active_back)
|
||||
{
|
||||
BLI_assert(ar != NULL);
|
||||
BLI_assert(BLI_findindex(&ar->uiblocks, but->block) != -1);
|
||||
/* note: ideally we would not have to change 'but->active' however
|
||||
* some functions we call don't use data (as they should be doing) */
|
||||
uiHandleButtonData *data;
|
||||
|
@ -9269,7 +9271,7 @@ static int ui_handle_menu_event(bContext *C,
|
|||
for (but = block->buttons.first; but; but = but->next) {
|
||||
if (!(but->flag & UI_BUT_DISABLED) && but->menu_key == event->type) {
|
||||
if (but->type == UI_BTYPE_BUT) {
|
||||
UI_but_execute(C, but);
|
||||
UI_but_execute(C, ar, but);
|
||||
}
|
||||
else {
|
||||
ui_handle_button_activate_by_type(C, ar, but);
|
||||
|
@ -9350,7 +9352,7 @@ static int ui_handle_menu_event(bContext *C,
|
|||
ar, UI_BUT_ACTIVE_DEFAULT, UI_HIDDEN);
|
||||
if ((but_default != NULL) && (but_default->active == NULL)) {
|
||||
if (but_default->type == UI_BTYPE_BUT) {
|
||||
UI_but_execute(C, but_default);
|
||||
UI_but_execute(C, ar, but_default);
|
||||
}
|
||||
else {
|
||||
ui_handle_button_activate_by_type(C, ar, but_default);
|
||||
|
|
|
@ -1545,7 +1545,7 @@ static int ui_button_press_invoke(bContext *C, wmOperator *op, const wmEvent *ev
|
|||
* having this avoids a minor drawing glitch. */
|
||||
void *but_optype = but->optype;
|
||||
|
||||
UI_but_execute(C, but);
|
||||
UI_but_execute(C, ar, but);
|
||||
|
||||
but->optype = but_optype;
|
||||
|
||||
|
|
Loading…
Reference in New Issue