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

Unified Diff: core/fxge/ge/cfx_font.cpp

Issue 2322043002: Fix memory management errors for font loading and copying (Closed)
Patch Set: address comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/fxge/include/fx_font.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxge/ge/cfx_font.cpp
diff --git a/core/fxge/ge/cfx_font.cpp b/core/fxge/ge/cfx_font.cpp
index 4aefec8d43b2a06ab95b92f2ef3e149a812baadd..3d2e6d64991d04e5ceeebd941ed375ff59c48dd3 100644
--- a/core/fxge/ge/cfx_font.cpp
+++ b/core/fxge/ge/cfx_font.cpp
@@ -220,7 +220,7 @@ const uint8_t CFX_Font::s_WeightPow_SHIFTJIS[] = {
CFX_Font::CFX_Font()
:
#ifdef PDF_ENABLE_XFA
- m_bLogic(FALSE),
+ m_bShallowCopy(false),
m_pOwnedStream(nullptr),
#endif // PDF_ENABLE_XFA
m_Face(nullptr),
@@ -239,7 +239,7 @@ FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) {
if (!pFont)
return FALSE;
- m_bLogic = TRUE;
+ m_bShallowCopy = true;
if (pFont->m_pSubstFont) {
m_pSubstFont.reset(new CFX_SubstFont);
m_pSubstFont->m_Charset = pFont->m_pSubstFont->m_Charset;
@@ -268,7 +268,7 @@ FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) {
CFX_Font::~CFX_Font() {
#ifdef PDF_ENABLE_XFA
- if (m_bLogic) {
+ if (m_bShallowCopy) {
m_OtfFontData.DetachBuffer();
return;
}
@@ -285,7 +285,7 @@ CFX_Font::~CFX_Font() {
CFX_GEModule::Get()->GetFontMgr()->ReleaseFace(m_Face);
}
#ifdef PDF_ENABLE_XFA
- FX_Free(m_pOwnedStream);
+ delete m_pOwnedStream;
#endif // PDF_ENABLE_XFA
FX_Free(m_pGsubData);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ && !defined _SKIA_SUPPORT_
« no previous file with comments | « no previous file | core/fxge/include/fx_font.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698