- 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.
This commit is contained in:
Christoph Oelckers 2022-06-23 00:12:53 +02:00
parent 67127e4cce
commit 124d71a7be

View file

@ -10,6 +10,7 @@
#include "utf8.h" #include "utf8.h"
#include "v_font.h" #include "v_font.h"
#include "i_net.h" #include "i_net.h"
#include "engineerrors.h"
#include <richedit.h> #include <richedit.h>
#include <shellapi.h> #include <shellapi.h>
#include <commctrl.h> #include <commctrl.h>
@ -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) if (msg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDCANCEL)
{ {
PostQuitMessage(0); PostMessage(hDlg, WM_COMMAND, 1337, 1337);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@ -357,6 +358,11 @@ bool MainWindow::RunMessageLoop(bool (*timer_callback)(void*), void* userdata)
} }
else 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 (msg.message == WM_TIMER && msg.hwnd == Window && msg.wParam == 1337)
{ {
if (timer_callback(userdata)) if (timer_callback(userdata))