From 124d71a7be1b00a26a9b64f4b6a6886a47ca3aae Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 23 Jun 2022 00:12:53 +0200 Subject: [PATCH] - let the "abort" button on the network pane of the startup screen do a hard exit on Windows. This merely posted a quit message which did not get properly processed and let the game run into other code with incompletely set up data. --- src/common/platform/win32/i_mainwindow.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/platform/win32/i_mainwindow.cpp b/src/common/platform/win32/i_mainwindow.cpp index d3e27b21c..3395ec430 100644 --- a/src/common/platform/win32/i_mainwindow.cpp +++ b/src/common/platform/win32/i_mainwindow.cpp @@ -10,6 +10,7 @@ #include "utf8.h" #include "v_font.h" #include "i_net.h" +#include "engineerrors.h" #include #include #include @@ -264,7 +265,7 @@ static INT_PTR CALLBACK NetStartPaneProc(HWND hDlg, UINT msg, WPARAM wParam, LPA { if (msg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDCANCEL) { - PostQuitMessage(0); + PostMessage(hDlg, WM_COMMAND, 1337, 1337); return TRUE; } return FALSE; @@ -357,6 +358,11 @@ bool MainWindow::RunMessageLoop(bool (*timer_callback)(void*), void* userdata) } else { + // This must be outside the window function so that the exception does not cross DLL boundaries. + if (msg.message == WM_COMMAND && msg.wParam == 1337 && msg.lParam == 1337) + { + throw CExitEvent(0); + } if (msg.message == WM_TIMER && msg.hwnd == Window && msg.wParam == 1337) { if (timer_callback(userdata))