BLF: avoid glyph cache use-after free
authorCampbell Barton <ideasman42@gmail.com>
Fri, 14 Apr 2017 09:52:29 +0000 (19:52 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 14 Apr 2017 09:54:09 +0000 (19:54 +1000)
Causes crash if the font size isn't set after clearing (see T51200)

source/blender/blenfont/intern/blf_glyph.c

index aa7d539538b0249c71c1656c0280414e8efa2628..bbbabfb8ba25f992fabd1c88b3db8ab2a812b470 100644 (file)
@@ -135,6 +135,7 @@ void blf_glyph_cache_clear(FontBLF *font)
        while ((gc = BLI_pophead(&font->cache))) {
                blf_glyph_cache_free(gc);
        }
+       font->glyph_cache = NULL;
 }
 
 void blf_glyph_cache_free(GlyphCacheBLF *gc)