From d1ff9b8ffb15569d1df2e7975e4592f26af9d242 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Tue, 10 May 2022 19:19:27 +0200 Subject: [PATCH] process_ctrlc_stub: Remove Ctrl-C child termination mechanism MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since 537ba23fff8cd2b3f2172042ecfba94484d55efb we have on Windows a method that lets the operating system kill child processes when the ctrlc_stub starter process dies. Previously process_ctrlc_stub would generate a Ctrl+C event sent via GenerateConsoleCtrlEvent for the child process to terminate. This had a sideeffect of terminating also Qt Creator when ran in debug mode since it shared the console. See QTCREATORBUG-11995 for all the details. Change-Id: Ia6fd6240927f95895a4c977e742714f959d3fab7 Reviewed-by: Jörg Bornemann Reviewed-by: Orgad Shaneh --- src/libs/utils/process_ctrlc_stub.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/libs/utils/process_ctrlc_stub.cpp b/src/libs/utils/process_ctrlc_stub.cpp index 33694d64487..8abd3bca206 100644 --- a/src/libs/utils/process_ctrlc_stub.cpp +++ b/src/libs/utils/process_ctrlc_stub.cpp @@ -167,13 +167,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { if (message == uiShutDownWindowMessage) { SetConsoleCtrlHandler(interruptHandler, FALSE); - SetConsoleCtrlHandler(shutdownHandler, TRUE); - GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0); PostQuitMessage(0); return 0; } else if (message == uiInterruptMessage) { SetConsoleCtrlHandler(interruptHandler, TRUE); - SetConsoleCtrlHandler(shutdownHandler, FALSE); GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0); return 0; } @@ -194,12 +191,6 @@ bool isSpaceOrTab(const wchar_t c) return c == L' ' || c == L'\t'; } -BOOL WINAPI shutdownHandler(DWORD /*dwCtrlType*/) -{ - PostMessage(hwndMain, WM_DESTROY, 0, 0); - return TRUE; -} - BOOL WINAPI interruptHandler(DWORD /*dwCtrlType*/) { return TRUE;