mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Fix rare crash in 'ImGui_ImplWin32_WndProcHandler'
Don't run the 'ImGui_ImplWin32_WndProcHandler' if we are shutting down. During rare occasions when closing the game while hovering over the game window, 'ImGui_ImplWin32_WndProcHandler' is getting called while parts or all of the ImGui systems have been shut down, leading to a crash. The fix is to check if the engine is restarting or shutting down before running the ImGui window procedure logic.
This commit is contained in:
parent
be93929b26
commit
bfd093d22b
@ -8,6 +8,7 @@
|
||||
#include "windows/id3dx.h"
|
||||
#include "windows/input.h"
|
||||
#include "engine/sys_mainwind.h"
|
||||
#include "engine/sys_engine.h"
|
||||
#include "gameui/IConsole.h"
|
||||
#include "gameui/IBrowser.h"
|
||||
|
||||
@ -30,17 +31,25 @@ int CGame::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
if (!g_bImGuiInitialized)
|
||||
return v_CGame__WindowProc(hWnd, uMsg, wParam, lParam);
|
||||
|
||||
const IEngine::EngineState_t state = g_pEngine->GetState();
|
||||
|
||||
if (state == IEngine::DLL_CLOSE ||
|
||||
state == IEngine::DLL_RESTART)
|
||||
return v_CGame__WindowProc(hWnd, uMsg, wParam, lParam);
|
||||
|
||||
ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam);
|
||||
|
||||
if (uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN)
|
||||
{
|
||||
if (wParam == g_pImGuiConfig->m_ConsoleConfig.m_nBind0 || wParam == g_pImGuiConfig->m_ConsoleConfig.m_nBind1)
|
||||
if (wParam == g_pImGuiConfig->m_ConsoleConfig.m_nBind0 ||
|
||||
wParam == g_pImGuiConfig->m_ConsoleConfig.m_nBind1)
|
||||
{
|
||||
g_pConsole->m_bActivate ^= true;
|
||||
ResetInput(); // Disable input to game when console is drawn.
|
||||
}
|
||||
|
||||
if (wParam == g_pImGuiConfig->m_BrowserConfig.m_nBind0 || wParam == g_pImGuiConfig->m_BrowserConfig.m_nBind1)
|
||||
if (wParam == g_pImGuiConfig->m_BrowserConfig.m_nBind0 ||
|
||||
wParam == g_pImGuiConfig->m_BrowserConfig.m_nBind1)
|
||||
{
|
||||
g_pBrowser->m_bActivate ^= true;
|
||||
ResetInput(); // Disable input to game when browser is drawn.
|
||||
|
Loading…
x
Reference in New Issue
Block a user