diff --git a/src/common/platform/win32/i_main.cpp b/src/common/platform/win32/i_main.cpp index 200cd541b..c05e1aaba 100644 --- a/src/common/platform/win32/i_main.cpp +++ b/src/common/platform/win32/i_main.cpp @@ -229,9 +229,6 @@ int DoMain (HINSTANCE hInstance) WinWidth = cRect.right; WinHeight = cRect.bottom; - if (SUCCEEDED(CoInitialize(nullptr))) - atexit ([](){ CoUninitialize(); }); // beware of calling convention. - int ret = GameMain (); if (mainwindow.CheckForRestart()) @@ -296,6 +293,9 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE nothing, LPWSTR cmdline, int InitCommonControls(); + if (SUCCEEDED(CoInitialize(nullptr))) + atexit([]() { CoUninitialize(); }); // beware of calling convention. + #if defined(_DEBUG) && defined(_MSC_VER) // Uncomment this line to make the Visual C++ CRT check the heap before // every allocation and deallocation. This will be slow, but it can be a