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

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

Issue 2631703003: Avoid endless loop deleting CFGAS_GEFont. (Closed)
Patch Set: rebase Created 3 years, 11 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
« no previous file with comments | « xfa/fgas/font/cfgas_gefont.h ('k') | xfa/fxfa/app/cxfa_pieceline.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fgas/font/cfgas_gefont.cpp
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index 49639c2005e6397bf39cd9dddfbba5813bdceee0..d0e7f13c3ae31245bfc6243f5998aa41e72e91c2 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -27,8 +27,7 @@ CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::LoadFont(
if (!pFontMgr)
return nullptr;
- return CFX_RetainPtr<CFGAS_GEFont>(
- pFontMgr->GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily));
+ return pFontMgr->GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily);
#else
auto pFont = pdfium::MakeRetain<CFGAS_GEFont>(pFontMgr);
if (!pFont->LoadFontInternal(pszFontFamily, dwFontStyles, wCodePage))
@@ -119,9 +118,6 @@ CFGAS_GEFont::CFGAS_GEFont(const CFX_RetainPtr<CFGAS_GEFont>& src,
}
CFGAS_GEFont::~CFGAS_GEFont() {
- if (m_pFontMgr)
- m_pFontMgr->RemoveFont(CFX_RetainPtr<CFGAS_GEFont>(this));
-
if (!m_bExternalFont)
delete m_pFont;
}
@@ -429,10 +425,9 @@ int32_t CFGAS_GEFont::GetDescent() const {
return m_pFont->GetDescent();
}
-CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::GetSubstFont(
- int32_t iGlyphIndex) const {
+CFX_RetainPtr<CFGAS_GEFont> CFGAS_GEFont::GetSubstFont(int32_t iGlyphIndex) {
iGlyphIndex = static_cast<uint32_t>(iGlyphIndex) >> 24;
if (iGlyphIndex == 0)
- return CFX_RetainPtr<CFGAS_GEFont>(const_cast<CFGAS_GEFont*>(this));
+ return CFX_RetainPtr<CFGAS_GEFont>(this);
return m_SubstFonts[iGlyphIndex - 1];
}
« no previous file with comments | « xfa/fgas/font/cfgas_gefont.h ('k') | xfa/fxfa/app/cxfa_pieceline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698