From 500fba7f6c86098022daf9ca9736ea4fa7f282a5 Mon Sep 17 00:00:00 2001 From: FlightlessMango Date: Sun, 16 Aug 2020 15:03:00 +0200 Subject: [PATCH] Fix for memory leak in source 1 games --- src/gl/imgui_hud.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gl/imgui_hud.cpp b/src/gl/imgui_hud.cpp index 2eb79787..257ad62f 100644 --- a/src/gl/imgui_hud.cpp +++ b/src/gl/imgui_hud.cpp @@ -82,13 +82,14 @@ void imgui_create(void *ctx) { if (inited) return; - inited = true; if (!ctx) return; - + + imgui_shutdown(); imgui_init(); - + inited = true; + gladLoadGL(); GetOpenGLVersion(sw_stats.version_gl.major, @@ -154,10 +155,9 @@ void imgui_shutdown() void imgui_set_context(void *ctx) { - if (!ctx) { - imgui_shutdown(); + if (!ctx) return; - } + #ifndef NDEBUG std::cerr << __func__ << ": " << ctx << std::endl; #endif