poppler/CairoFontEngine.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
New commits: commit da226d346e691f7545d995d6761d43e08855a3b7 Author: Adrian Johnson <[email protected]> Date: Sat Jun 11 20:36:13 2022 +0930 CairoFontEnginer: increment font_face reference when retrieving from the cache since ~CairoFont() will decrement the reference count diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc index f73b4201..061aa62b 100644 --- a/poppler/CairoFontEngine.cc +++ b/poppler/CairoFontEngine.cc @@ -635,7 +635,9 @@ std::optional<FreeTypeFontFace> CairoFontEngine::getExternalFontFace(FT_Library auto it = fontFileCache.find(filename); if (it != fontFileCache.end()) { - return it->second; + FreeTypeFontFace font = it->second; + cairo_font_face_reference(font.cairo_font_face); + return font; } std::optional<FreeTypeFontFace> font_face = createFreeTypeFontFace(ftlib, filename, {});
