From 4dce6d4689d464c3a8825a5d6aa790adfc9228ee Mon Sep 17 00:00:00 2001 From: thestig Date: Tue, 31 May 2016 05:46:52 -0700 Subject: Fix a leak in CXFA_FontMgr. Review-Url: https://codereview.chromium.org/2024713002 --- xfa/fxfa/app/xfa_fontmgr.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'xfa/fxfa/app/xfa_fontmgr.cpp') diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index 9fec265a5a..ae1449876f 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -7,6 +7,7 @@ #include "xfa/fxfa/include/xfa_fontmgr.h" #include +#include #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" @@ -1997,7 +1998,7 @@ FX_BOOL CXFA_PDFFontMgr::GetCharWidth(IFX_Font* pFont, return TRUE; } -CXFA_FontMgr::CXFA_FontMgr() : m_pDefFontMgr(nullptr) {} +CXFA_FontMgr::CXFA_FontMgr() {} CXFA_FontMgr::~CXFA_FontMgr() {} @@ -2023,9 +2024,9 @@ IFX_Font* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc, if (pFont) return pFont; } - if (!pFont && m_pDefFontMgr) { + if (!pFont && m_pDefFontMgr) pFont = m_pDefFontMgr->GetFont(hDoc, wsFontFamily, dwFontStyles, wCodePage); - } + if (!pFont && pMgr) { pPDFFont = nullptr; pFont = pMgr->GetFont(wsEnglishName.AsStringC(), dwFontStyles, &pPDFFont, @@ -2056,6 +2057,6 @@ void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) { m_PDFFontMgrMap.erase(hDoc); } -void CXFA_FontMgr::SetDefFontMgr(CXFA_DefFontMgr* pFontMgr) { - m_pDefFontMgr = pFontMgr; +void CXFA_FontMgr::SetDefFontMgr(std::unique_ptr pFontMgr) { + m_pDefFontMgr = std::move(pFontMgr); } -- cgit v1.2.3