From 4a4f4331c257506a63e8485c6d29e604b4c04028 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Fri, 12 Jun 2020 19:50:07 +0000 Subject: [PATCH] Bug 1645482 - Don't leak dwrite font table references after reading font names. r=jwatt Differential Revision: https://phabricator.services.mozilla.com/D79534 --- gfx/thebes/gfxDWriteFontList.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gfx/thebes/gfxDWriteFontList.cpp b/gfx/thebes/gfxDWriteFontList.cpp index 74ca238e5ba9..b39309948205 100644 --- a/gfx/thebes/gfxDWriteFontList.cpp +++ b/gfx/thebes/gfxDWriteFontList.cpp @@ -1113,6 +1113,7 @@ void gfxDWriteFontList::GetFacesInitDataForFamily( exists) { gfxFontUtils::ReadCanonicalName( data, size, gfxFontUtils::NAME_ID_POSTSCRIPT, name); + dwFontFace->ReleaseFontTable(context); } } } @@ -1185,6 +1186,7 @@ bool gfxDWriteFontList::ReadFaceNames(fontlist::Family* aFamily, result = SUCCEEDED(ps) && !aPSName.IsEmpty(); } } + dwFontFace->ReleaseFontTable(context); return result; } return true; @@ -2092,7 +2094,7 @@ void DirectWriteFontInfo::LoadFontFamilyData(const nsACString& aFamilyName) { hr = dwFontFace->TryGetFontTable(kCMAP, (const void**)&cmapData, &cmapSize, &ctx, &exists); - if (SUCCEEDED(hr)) { + if (SUCCEEDED(hr) && exists) { bool cmapLoaded = false; RefPtr charmap = new gfxCharacterMap(); uint32_t offset;