De-construct empty cache tree branches on GC

This commit is contained in:
Charles J. Cliffe 2016-03-15 01:25:07 -04:00
parent 297e35ebf7
commit 7b3942fbcf
1 changed files with 10 additions and 0 deletions

View File

@ -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));
}
}
}
}
}
}