Codefix: SpriteFontCache was never deleted. (#14414)

This commit is contained in:
Peter Nelson 2025-07-05 13:22:45 +01:00 committed by GitHub
parent ebd984d894
commit 84e9e106c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -43,7 +43,7 @@ FontCache::FontCache(FontSize fs) : parent(FontCache::Get(fs)), fs(fs), height(_
/** Clean everything up. */
FontCache::~FontCache()
{
assert(this->fs == this->parent->fs);
assert(this->parent == nullptr || this->fs == this->parent->fs);
FontCache::caches[this->fs] = this->parent;
Layouter::ResetFontCache(this->fs);
}
@ -241,8 +241,7 @@ void InitFontCache(bool monospace)
void UninitFontCache()
{
for (FontSize fs = FS_BEGIN; fs < FS_END; fs++) {
FontCache *fc = FontCache::Get(fs);
if (fc->HasParent()) delete fc;
while (FontCache::Get(fs) != nullptr) delete FontCache::Get(fs);
}
#ifdef WITH_FREETYPE