Fix: Invalid memory access closing window with escape

After recent #132539.
This commit is contained in:
Brecht Van Lommel
2025-01-13 09:37:26 +01:00
parent 96eef81d90
commit 357d748b18

View File

@@ -3401,6 +3401,8 @@ static eHandlerActionFlag wm_handlers_do_intern(bContext *C,
wmEventHandler_KeymapResult km_result;
WM_event_get_keymaps_from_handler(wm, win, handler, &km_result);
eHandlerActionFlag action_iter = WM_HANDLER_CONTINUE;
/* Compute in advance, as event may be freed on WM_HANDLER_BREAK. */
const bool event_is_timer = ISTIMER(event->type);
for (int km_index = 0; km_index < km_result.keymaps_len; km_index++) {
wmKeyMap *keymap = km_result.keymaps[km_index];
action_iter |= wm_handlers_do_keymap_with_keymap_handler(
@@ -3413,7 +3415,7 @@ static eHandlerActionFlag wm_handlers_do_intern(bContext *C,
/* Clear the tool-tip whenever a key binding is handled, without this tool-tips
* are kept when a modal operators starts (annoying but otherwise harmless). */
if (action & WM_HANDLER_BREAK && !ISTIMER(event->type)) {
if (action & WM_HANDLER_BREAK && !event_is_timer) {
/* Window may be gone after file read. */
if (CTX_wm_window(C) != nullptr) {
WM_tooltip_clear(C, CTX_wm_window(C));