From fc51d0e7ae710ae70a63ee1c3821e8eab36f7c55 Mon Sep 17 00:00:00 2001 From: RadiantDerg <9061202+RadiantDerg@users.noreply.github.com> Date: Fri, 17 Jan 2025 19:22:04 -0600 Subject: [PATCH] Fix potential memory issue Text/Line vectors could've been added to even if Reddog was never enabled, thus only ever expanding in size as they couldn't update. --- UnleashedRecomp/ui/reddog/debug_draw.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/UnleashedRecomp/ui/reddog/debug_draw.cpp b/UnleashedRecomp/ui/reddog/debug_draw.cpp index 8b93900..bd13154 100644 --- a/UnleashedRecomp/ui/reddog/debug_draw.cpp +++ b/UnleashedRecomp/ui/reddog/debug_draw.cpp @@ -160,19 +160,19 @@ namespace Reddog void DebugDraw::DrawLine(const SDrawLine& in_rLine) { - if (!ms_IsRendering && GetIsDrawDebug()) + if (Config::Debug && !ms_IsRendering && GetIsDrawDebug()) ms_LineList.push_back(in_rLine); } void DebugDraw::DrawText2D(const SDrawText& in_rText) { - if (!ms_IsRendering && GetIsDrawText()) + if (Config::Debug && !ms_IsRendering && GetIsDrawText()) ms_FreeTextList.push_back(in_rText); } void DebugDraw::DrawText2D(const SDrawText& in_rText, const Vector3& in_rPosition) { - if (!ms_IsRendering && GetIsDrawText()) + if (Config::Debug && !ms_IsRendering && GetIsDrawText()) { auto txt = in_rText; txt.Position = GetNDCCoordinate(in_rPosition); @@ -182,13 +182,13 @@ namespace Reddog void DebugDraw::DrawTextLog(const SDrawText& in_rText) { - if (!ms_IsRendering && GetIsDrawText()) + if (Config::Debug && !ms_IsRendering && GetIsDrawText()) ms_LogTextList.push_back(in_rText); } void DebugDraw::DrawTextLog(const char* in_Text, float in_Time, ImU32 in_Colour, ImU16 in_Priority) { - if (!ms_IsRendering && GetIsDrawText()) + if (Config::Debug && !ms_IsRendering && GetIsDrawText()) ms_LogTextList.push_back({ ImVec2(0,0), in_Text, in_Time, 0, in_Colour, eDrawTextFlags_None, in_Priority}); }