Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(923)

Unified Diff: xfa/fgas/font/fgas_gefont.cpp

Issue 2297303004: Fix leaked internal font (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: xfa/fgas/font/fgas_gefont.cpp
diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp
index 1507fa4840a22c21e6ff185c22d390490ae77554..f3aca37a00ead060610802f3ed9d9fc6731bbf4a 100644
--- a/xfa/fgas/font/fgas_gefont.cpp
+++ b/xfa/fgas/font/fgas_gefont.cpp
@@ -34,10 +34,11 @@ CFGAS_GEFont* CFGAS_GEFont::LoadFont(const FX_WCHAR* pszFontFamily,
}
// static
-CFGAS_GEFont* CFGAS_GEFont::LoadFont(CFX_Font* pExtFont,
+CFGAS_GEFont* CFGAS_GEFont::LoadFont(CFX_Font* pSrcFont,
+ bool bExternalFont,
IFGAS_FontMgr* pFontMgr) {
CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr);
- if (!pFont->LoadFontInternal(pExtFont)) {
+ if (!pFont->LoadFontInternal(pSrcFont, bExternalFont)) {
pFont->Release();
return nullptr;
}
@@ -209,12 +210,12 @@ FX_BOOL CFGAS_GEFont::LoadFontInternal(IFX_Stream* pFontStream,
}
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-FX_BOOL CFGAS_GEFont::LoadFontInternal(CFX_Font* pExtFont) {
- if (m_pFont || !pExtFont) {
+FX_BOOL CFGAS_GEFont::LoadFontInternal(CFX_Font* pFont, bool bExternalFont) {
+ if (m_pFont || !pFont)
return FALSE;
- }
- m_pFont = pExtFont;
- m_bExtFont = TRUE;
+
+ m_pFont = pFont;
+ m_bExtFont = bExternalFont;
Lei Zhang 2016/09/01 22:55:42 Can we name |m_bExtFont| to |m_bExternalFont| late
Wei Li 2016/09/01 23:43:30 Done.
return InitFont();
}

Powered by Google App Engine
This is Rietveld 408576698