NoGUI: Fix ImGui assertion on confirm/error message

This commit is contained in:
Connor McLaughlin 2021-02-04 13:43:15 +10:00
parent 2029702eda
commit 0d911f1ccd
1 changed files with 14 additions and 6 deletions

View File

@ -18,8 +18,9 @@
#include "frontend-common/vulkan_host_display.h"
#include <cinttypes>
#include <cmath>
#include <imgui.h>
#include <imgui_stdlib.h>
#include "imgui.h"
#include "imgui_internal.h"
#include "imgui_stdlib.h"
Log_SetChannel(NoGUIHostInterface);
#ifdef WIN32
@ -409,6 +410,8 @@ void NoGUIHostInterface::ReportError(const char* message)
if (!m_display)
return;
const bool was_in_frame = GImGui->FrameCount != GImGui->FrameCountEnded;
if (was_in_frame)
ImGui::EndFrame();
bool done = false;
@ -425,6 +428,7 @@ void NoGUIHostInterface::ReportError(const char* message)
m_display->Render();
}
if (was_in_frame)
ImGui::NewFrame();
}
@ -435,6 +439,8 @@ bool NoGUIHostInterface::ConfirmMessage(const char* message)
if (!m_display)
return true;
const bool was_in_frame = GImGui->FrameCount != GImGui->FrameCountEnded;
if (was_in_frame)
ImGui::EndFrame();
bool done = false;
@ -452,7 +458,9 @@ bool NoGUIHostInterface::ConfirmMessage(const char* message)
m_display->Render();
}
if (was_in_frame)
ImGui::NewFrame();
return result;
}