From f94e6cb73e1438eafb8219548d561fa69534f7ae Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Sun, 2 Feb 2025 13:02:58 -0800 Subject: [PATCH] PerformanceMetrics: Call ImGui::End() unconditionally Move ImGui::End() calls out of if(ImGui::Begin()) blocks. Quoting from ImGui::Begin's function comment in imgui.cpp: "You always need to call ImGui::End() even if false is returned." In practice this didn't cause problems because the windows don't have title bars and thus can't be collapsed, and so the block containing ::End would always run, but let's do it the right way. --- Source/Core/VideoCommon/PerformanceMetrics.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/VideoCommon/PerformanceMetrics.cpp b/Source/Core/VideoCommon/PerformanceMetrics.cpp index a3d41c9872..910b3c615e 100644 --- a/Source/Core/VideoCommon/PerformanceMetrics.cpp +++ b/Source/Core/VideoCommon/PerformanceMetrics.cpp @@ -183,8 +183,8 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale) ImPlot::PopStyleColor(2); } ImGui::PopStyleVar(); - ImGui::End(); } + ImGui::End(); } if (g_ActiveConfig.bShowSpeed) @@ -205,8 +205,8 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale) { ImGui::TextColored(ImVec4(r, g, b, 1.0f), "Speed:%4.0lf%%", 100.0 * speed); ImGui::TextColored(ImVec4(r, g, b, 1.0f), "Max:%6.0lf%%", 100.0 * GetMaxSpeed()); - ImGui::End(); } + ImGui::End(); } if (g_ActiveConfig.bShowFPS || g_ActiveConfig.bShowFTimes) @@ -235,8 +235,8 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale) ImGui::TextColored(ImVec4(r, g, b, 1.0f), " ±:%6.2lfms", DT_ms(m_fps_counter.GetDtStd()).count()); } - ImGui::End(); } + ImGui::End(); } if (g_ActiveConfig.bShowVPS || g_ActiveConfig.bShowVTimes) @@ -265,8 +265,8 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale) ImGui::TextColored(ImVec4(r, g, b, 1.0f), " ±:%6.2lfms", DT_ms(m_vps_counter.GetDtStd()).count()); } - ImGui::End(); } + ImGui::End(); } ImGui::PopStyleVar(2);