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

Side by Side Diff: xfa/fxfa/app/xfa_fontmgr.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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/include/xfa_fontmgr.h" 7 #include "xfa/fxfa/include/xfa_fontmgr.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 return nullptr; 1860 return nullptr;
1861 } 1861 }
1862 CPDF_Font* pPDFFont = pDoc->LoadFont(pFontDict); 1862 CPDF_Font* pPDFFont = pDoc->LoadFont(pFontDict);
1863 if (!pPDFFont) { 1863 if (!pPDFFont) {
1864 return nullptr; 1864 return nullptr;
1865 } 1865 }
1866 if (!pPDFFont->IsEmbedded()) { 1866 if (!pPDFFont->IsEmbedded()) {
1867 *pDstPDFFont = pPDFFont; 1867 *pDstPDFFont = pPDFFont;
1868 return nullptr; 1868 return nullptr;
1869 } 1869 }
1870 return CFGAS_GEFont::LoadFont(&pPDFFont->m_Font, pFDEFontMgr); 1870 return CFGAS_GEFont::LoadFont(&pPDFFont->m_Font, true, pFDEFontMgr);
1871 } 1871 }
1872 return nullptr; 1872 return nullptr;
1873 } 1873 }
1874 1874
1875 CFGAS_GEFont* CXFA_PDFFontMgr::GetFont(const CFX_WideStringC& wsFontFamily, 1875 CFGAS_GEFont* CXFA_PDFFontMgr::GetFont(const CFX_WideStringC& wsFontFamily,
1876 uint32_t dwFontStyles, 1876 uint32_t dwFontStyles,
1877 CPDF_Font** pPDFFont, 1877 CPDF_Font** pPDFFont,
1878 FX_BOOL bStrictMatch) { 1878 FX_BOOL bStrictMatch) {
1879 uint32_t dwHashCode = FX_HashCode_GetW(wsFontFamily, false); 1879 uint32_t dwHashCode = FX_HashCode_GetW(wsFontFamily, false);
1880 CFX_ByteString strKey; 1880 CFX_ByteString strKey;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 m_PDFFontMgrMap[hDoc].reset(new CXFA_PDFFontMgr(hDoc)); 2053 m_PDFFontMgrMap[hDoc].reset(new CXFA_PDFFontMgr(hDoc));
2054 } 2054 }
2055 2055
2056 void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) { 2056 void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) {
2057 m_PDFFontMgrMap.erase(hDoc); 2057 m_PDFFontMgrMap.erase(hDoc);
2058 } 2058 }
2059 2059
2060 void CXFA_FontMgr::SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) { 2060 void CXFA_FontMgr::SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) {
2061 m_pDefFontMgr = std::move(pFontMgr); 2061 m_pDefFontMgr = std::move(pFontMgr);
2062 } 2062 }
OLDNEW
« xfa/fgas/font/fgas_gefont.cpp ('K') | « xfa/fgas/font/fgas_stdfontmgr.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698