From 7b3942fbcfc632c4b0f14edf6d11923d3a3e158d Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Tue, 15 Mar 2016 01:25:07 -0400 Subject: [PATCH] De-construct empty cache tree branches on GC --- src/util/GLFont.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/util/GLFont.cpp b/src/util/GLFont.cpp index 0c7ebda..2923dad 100644 --- a/src/util/GLFont.cpp +++ b/src/util/GLFont.cpp @@ -707,6 +707,16 @@ void GLFont::doCacheGC() { GLFontStringCache *fc = (*removals_i)->second; stringCache[fc->vpx][fc->vpy][fc->pxHeight].erase(*removals_i); delete (*removals_i)->second; + + if (!stringCache[fc->vpx][fc->vpy][fc->pxHeight].size()) { + stringCache[fc->vpx][fc->vpy].erase(stringCache[fc->vpx][fc->vpy].find(fc->pxHeight)); + if (!stringCache[fc->vpx][fc->vpy].size()) { + stringCache[fc->vpx].erase(stringCache[fc->vpx].find(fc->vpy)); + if (!stringCache[fc->vpx].size()) { + stringCache.erase(stringCache.find(fc->vpx)); + } + } + } } } }