summaryrefslogtreecommitdiff
path: root/xfa/fgas/font/fgas_gefont.h
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-09-08 15:21:23 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-08 15:21:23 -0700
commit9a0736803ae6749ec508e1c3ff5f04a483bbcb56 (patch)
tree7ab220c65348600539d3ec4abf8c0f6e8c1a1dac /xfa/fgas/font/fgas_gefont.h
parent0ca160fbf31a7408df282823f7a3d4cbb5f386a1 (diff)
downloadpdfium-9a0736803ae6749ec508e1c3ff5f04a483bbcb56.tar.xz
Reland of Fix leaked internal font
Reland of Fix leaked internal font (patchset #2 id:60001 of https://codereview.chromium.org/2297303004/ ) 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 new method to take the ownership of the font and mark it as internal font properly. The previous revert was caused by memory management errors which were fixed at https://codereview.chromium.org/2322043002/ BUG=pdfium:242 Review-Url: https://codereview.chromium.org/2320213002
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 d139d445f4..824f931d76 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,
@@ -97,7 +101,7 @@ class CFGAS_GEFont {
CFGAS_GEFont* const m_pSrcFont;
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;