From 3021423a5fe9df1b22c6bf559a8cafd838f2e331 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 18 Nov 2023 17:45:43 -0800 Subject: [PATCH] github issue #1145 - ^C-induced panic on tty Issue reported by entrez: on tty, ^C while a menu was open followed by 'yes' to "Really quit?" would lead to a bad window panic. Brought on by screen erasure changes included with recent SIGWINCH (window resize signal) changes. Closes #1145 --- doc/fixes3-7-0.txt | 2 ++ win/tty/wintty.c | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index d88831001..671776554 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1823,6 +1823,8 @@ tty: for the !DEF_PAGER configuration, redraw screen properly if attempting feedback for that situation tty: if a group accelerator matched a menu command ('^' in menu for '/') it wouldn't work to select, just to manipulate the menu +tty: after resize changes which included screen erasure changes, ^C and yes|y + to "Really quit?" while a menu was open would lead to a panic Unix: after lua changes to Makefiles, 'make spotless' for dat subdirectory left some generated data files which should have been deleted Unix: reject "--sX" on command line except if "X" is "cores" (so "--scores"); diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 4d5f5ba2c..bb487541c 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -1077,9 +1077,9 @@ tty_clear_nhwindow(winid window) break; case NHW_MENU: case NHW_TEXT: - if (cw->active) - erase_menu_or_text(window, cw, TRUE); if (!erasing_tty_screen) { + if (cw->active) + erase_menu_or_text(window, cw, TRUE); free_window_info(cw, FALSE); } break; @@ -1953,7 +1953,7 @@ tty_dismiss_nhwindow(winid window) final run-down in case this is the end-of-game window; the contents of that window should remain shown even when the window itself has gone away */ - if (iflags.window_inited) { + if (iflags.window_inited && !erasing_tty_screen) { boolean clearscreen = FALSE; /* just erase the menu */ /* during role/race/&c selection, menus are put up on top @@ -2006,6 +2006,7 @@ erase_tty_screen(void) struct WinDesc *cw; int i; + HUPSKIP(); if (erasing_tty_screen++) return; #if 0 /* originally we called term_clear_screen() but now it calls us */