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

Unified Diff: core/src/fxge/ge/fx_ge_fontmap.cpp

Issue 1426103002: XFA: Take CTTFontDesc::ReleaseFace() changes from master. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 2 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/src/fxge/ge/text_int.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxge/ge/fx_ge_fontmap.cpp
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index 63cbecd0ebb45da2ff23a5c4d3a7a53e703fa35f..1360fc795da2012c956899dcc623215aff1ed5af 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -58,10 +58,10 @@ CTTFontDesc::~CTTFontDesc() {
}
FX_Free(m_pFontData);
}
-int32_t CTTFontDesc::ReleaseFace(FXFT_Face face) {
+FX_BOOL CTTFontDesc::ReleaseFace(FXFT_Face face) {
if (m_Type == 1) {
if (m_SingleFace.m_pFace != face) {
- return -1;
+ return FALSE;
}
} else if (m_Type == 2) {
int i;
@@ -70,15 +70,15 @@ int32_t CTTFontDesc::ReleaseFace(FXFT_Face face) {
break;
}
if (i == 16) {
- return -1;
+ return FALSE;
}
}
m_RefCount--;
if (m_RefCount) {
- return m_RefCount;
+ return FALSE;
}
delete this;
- return 0;
+ return TRUE;
}
CFX_FontMgr::CFX_FontMgr() : m_FTLibrary(nullptr) {
@@ -357,21 +357,13 @@ void CFX_FontMgr::ReleaseFace(FXFT_Face face) {
if (!face) {
return;
}
- FX_BOOL bNeedFaceDone = TRUE;
auto it = m_FaceMap.begin();
while (it != m_FaceMap.end()) {
auto temp = it++;
- int nRet = temp->second->ReleaseFace(face);
- if (nRet == 0) {
+ if (temp->second->ReleaseFace(face)) {
m_FaceMap.erase(temp);
- bNeedFaceDone = FALSE;
- } else if (nRet > 0) {
- bNeedFaceDone = FALSE;
}
}
- if (bNeedFaceDone && !m_pBuiltinMapper->IsBuiltinFace(face)) {
Lei Zhang 2015/10/30 06:35:47 CFX_FontMapper::IsBuiltinFace() is dead after this
- FXFT_Done_Face(face);
Lei Zhang 2015/10/30 06:35:47 Better to leak than double free.
- }
}
const FoxitFonts g_FoxitFonts[14] = {
{g_FoxitFixedFontData, 17597},
@@ -421,10 +413,10 @@ CFX_FontMapper::CFX_FontMapper(CFX_FontMgr* mgr)
FXSYS_memset(m_FoxitFaces, 0, sizeof(m_FoxitFaces));
}
CFX_FontMapper::~CFX_FontMapper() {
- for (int i = 0; i < 14; i++)
- if (m_FoxitFaces[i]) {
+ for (size_t i = 0; i < FX_ArraySize(m_FoxitFaces); ++i) {
+ if (m_FoxitFaces[i])
FXFT_Done_Face(m_FoxitFaces[i]);
- }
+ }
if (m_MMFaces[0]) {
FXFT_Done_Face(m_MMFaces[0]);
}
« no previous file with comments | « no previous file | core/src/fxge/ge/text_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698