Fix ImGui assertion when starting into DOOMEdit (+editor)

D3::ImGuiHooks::NewFrame() was still called every frame, but EndFrame()
wasn't because idSessionLocal::UpdateScreen() exited early.
This caused an assertion in Dear ImGui, because it doesn't like calling
NewFrame() if it has been called before without EndFrame() afterwards
This commit is contained in:
Daniel Gibson 2025-01-20 06:18:59 +01:00
parent 2d068377ae
commit 46052a9526

View file

@ -307,6 +307,14 @@ void Shutdown()
// => ProcessEvent() has already been called (probably multiple times)
void NewFrame()
{
// it can happen that NewFrame() is called without EndFrame() having been called
// after the last NewFrame() call, for example when D3Radiant is active and in
// idSessionLocal::UpdateScreen() Sys_IsWindowVisible() returns false.
// In that case, end the previous frame here so it's ended at all.
if ( haveNewFrame ) {
EndFrame();
}
// even if all windows are closed, still run a few frames
// so ImGui also recognizes internally that all windows are closed
// and e.g. ImGuiCond_Appearing works as intended