[console] Plug another escape handler leak

This commit is contained in:
Bill Currie 2021-07-24 00:28:49 +09:00
parent fbbf83e696
commit 632d2cb79c

View file

@ -359,6 +359,12 @@ bi_Menu_TopMenu (progs_t *pr)
top_menu = strdup (name);
}
static void
menu_leave (void *data)
{
Menu_Leave ();
}
static void
bi_Menu_SelectMenu (progs_t *pr)
{
@ -368,7 +374,11 @@ bi_Menu_SelectMenu (progs_t *pr)
if (name && *name)
menu = Hash_Find (menu_hash, name);
if (menu) {
Key_SetKeyDest (key_menu);
if (Key_GetKeyDest () != key_menu) {
menu_keydest = Key_GetKeyDest ();
Key_PushEscape (menu_leave, 0);
Key_SetKeyDest (key_menu);
}
if (menu->enter_hook) {
run_menu_pre ();
PR_ExecuteProgram (&menu_pr_state, menu->enter_hook);
@ -377,7 +387,7 @@ bi_Menu_SelectMenu (progs_t *pr)
} else {
if (name && *name)
Sys_Printf ("no menu \"%s\"\n", name);
Key_PopEscape ();
Key_PopEscape ();
Key_SetKeyDest (menu_keydest);
}
}
@ -463,6 +473,7 @@ bi_Menu_Leave (progs_t *pr)
}
menu = menu->parent;
if (!menu) {
Key_PopEscape ();
Key_SetKeyDest (menu_keydest);
}
}
@ -780,12 +791,6 @@ Menu_KeyEvent (knum_t key, short unicode, qboolean down)
}
}
static void
menu_leave (void *data)
{
Menu_Leave ();
}
void
Menu_Enter ()
{