process_ctrlc_stub: Remove Ctrl-C child termination mechanism

Since 537ba23fff 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 <joerg.bornemann@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Cristian Adam
2022-05-10 19:19:27 +02:00
parent 49ddf8434f
commit d1ff9b8ffb

View File

@@ -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;