summaryrefslogtreecommitdiff
path: root/xfa/fgas/font/fgas_gefont.h
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-09-01 17:10:12 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-01 17:10:12 -0700
commit6708106e6a3d54f3370c871ebf6643d1ecf58999 (patch)
tree97928e4492dd25692a7677b0e35339f8ee1614cf /xfa/fgas/font/fgas_gefont.h
parent7c5d090719a25f0c1b81fb6b46544b9394a7fdd2 (diff)
downloadpdfium-6708106e6a3d54f3370c871ebf6643d1ecf58999.tar.xz
Fix leaked internal font
In CFGAS_FontMgrImp::LoadFont(), a new internal font is created which is never released. It needs to be correctly marked as internal font to be released. Fix this by adding a boolean parameter and pass it along during the creation of the font. BUG=pdfium:242 Review-Url: https://codereview.chromium.org/2297303004
Diffstat (limited to 'xfa/fgas/font/fgas_gefont.h')
-rw-r--r--xfa/fgas/font/fgas_gefont.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/xfa/fgas/font/fgas_gefont.h b/xfa/fgas/font/fgas_gefont.h
index cdb19338a2..05c7640afb 100644
--- a/xfa/fgas/font/fgas_gefont.h
+++ b/xfa/fgas/font/fgas_gefont.h
@@ -24,7 +24,10 @@ class CFGAS_GEFont {
uint32_t dwFontStyles,
uint16_t wCodePage,
IFGAS_FontMgr* pFontMgr);
- static CFGAS_GEFont* LoadFont(CFX_Font* pExtFont, IFGAS_FontMgr* pFontMgr);
+ static CFGAS_GEFont* LoadFont(CFX_Font* pExternalFont,
+ IFGAS_FontMgr* pFontMgr);
+ static CFGAS_GEFont* LoadFont(std::unique_ptr<CFX_Font> pInternalFont,
+ IFGAS_FontMgr* pFontMgr);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
static CFGAS_GEFont* LoadFont(const uint8_t* pBuffer,
int32_t iLength,
@@ -74,7 +77,8 @@ class CFGAS_GEFont {
FX_BOOL LoadFontInternal(const uint8_t* pBuffer, int32_t length);
FX_BOOL LoadFontInternal(IFX_Stream* pFontStream, FX_BOOL bSaveStream);
#endif
- FX_BOOL LoadFontInternal(CFX_Font* pExtFont);
+ FX_BOOL LoadFontInternal(CFX_Font* pExternalFont);
+ FX_BOOL LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont);
FX_BOOL InitFont();
FX_BOOL GetCharBBoxInternal(FX_WCHAR wUnicode,
CFX_Rect& bbox,
@@ -96,7 +100,7 @@ class CFGAS_GEFont {
CFX_Font* m_pFont;
IFGAS_FontMgr* const m_pFontMgr;
int32_t m_iRefCount;
- FX_BOOL m_bExtFont;
+ bool m_bExternalFont;
std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> m_pStream;
std::unique_ptr<IFX_FileRead, ReleaseDeleter<IFX_FileRead>> m_pFileRead;
std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding;