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))