From 8178b12af4786b2e95dbeb282c98adf9450a2444 Mon Sep 17 00:00:00 2001 From: Jesse Yurkovich Date: Wed, 8 Nov 2023 03:30:42 +0100 Subject: [PATCH] Windows: Remove wait for key-press in --debug mode This was initially added a long time ago[1] to help with certain exit behavior while running under a debugger. However, this shouldn't be necessary any longer. More importantly, tests have started to use the `--debug` option[2]. Somehow the bots are fine, but anyone running the tests locally on Windows will experience what looks like a hang; unless they press a key to allow the tests to continue. [1] 1cc19c6993 [2] The `blendfile_versioning` test Pull Request: https://projects.blender.org/blender/blender/pulls/114605 --- .../windowmanager/intern/wm_init_exit.cc | 37 ------------------- 1 file changed, 37 deletions(-) diff --git a/source/blender/windowmanager/intern/wm_init_exit.cc b/source/blender/windowmanager/intern/wm_init_exit.cc index bbf7d4595dd..c3b647e773c 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.cc +++ b/source/blender/windowmanager/intern/wm_init_exit.cc @@ -12,11 +12,6 @@ #include #include -#ifdef _WIN32 -# define WIN32_LEAN_AND_MEAN -# include -#endif - #include "MEM_guardedalloc.h" #include "CLG_log.h" @@ -459,30 +454,6 @@ static void free_openrecent() BLI_freelistN(&(G.recent_files)); } -#ifdef WIN32 -/* Read console events until there is a key event. Also returns on any error. */ -static void wait_for_console_key() -{ - HANDLE hConsoleInput = GetStdHandle(STD_INPUT_HANDLE); - - if (!ELEM(hConsoleInput, nullptr, INVALID_HANDLE_VALUE) && - FlushConsoleInputBuffer(hConsoleInput)) { - for (;;) { - INPUT_RECORD buffer; - DWORD ignored; - - if (!ReadConsoleInput(hConsoleInput, &buffer, 1, &ignored)) { - break; - } - - if (buffer.EventType == KEY_EVENT) { - break; - } - } - } -} -#endif - static int wm_exit_handler(bContext *C, const wmEvent *event, void *userdata) { WM_exit(C, EXIT_SUCCESS); @@ -759,14 +730,6 @@ void WM_exit(bContext *C, const int exit_code) printf("\nBlender quit\n"); -#ifdef WIN32 - /* ask user to press a key when in debug mode */ - if (G.debug & G_DEBUG) { - printf("Press any key to exit . . .\n\n"); - wait_for_console_key(); - } -#endif - exit(exit_code); }