From 87af3a8cacad95426257fd147b9e8577a1a0ca0c Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 12 Oct 2024 09:28:29 -0400 Subject: [PATCH] fuzzer under Windows GUI hangs on minimize window On the Windows GUI (nethackw.exe), while running the fuzzer, if the NetHack window gets minimized, or someone minimizes all desktop windows, the NetHack window stops responding and won't even repaint itself. The NetHack process continues to use the CPU. A break in the debugger shows that it is caught in a do loop. I didn't delve into the issue of why minimizing the window triggers a condition that leads to the endless loop. This just adds a kludge to exit the loop while fuzzing. --- win/win32/mhmenu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/win/win32/mhmenu.c b/win/win32/mhmenu.c index 89d90e2ab..dfd7a49c9 100644 --- a/win/win32/mhmenu.c +++ b/win/win32/mhmenu.c @@ -1532,6 +1532,8 @@ onListChar(HWND hWnd, HWND hwndList, WORD ch) int iter = topIndex; do { i = iter % data->menui.menu.size; + if (iflags.debug_fuzzer && iter > 1000000) + ch = data->menui.menu.items[i].accelerator; if (data->menui.menu.items[i].accelerator == ch) { if (data->how == PICK_ANY) { SelectMenuItem(