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

Unified Diff: xfa/fde/xml/fde_xml_imp.cpp

Issue 1980223002: Revert of Replace Release() { delete this; } in fde_xml_imp.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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/fde/xml/fde_xml_imp.h ('k') | xfa/fxfa/app/xfa_ffdoc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fde/xml/fde_xml_imp.cpp
diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp
index f630a8995e3c51ee381bd1162e6479708d6c3e3d..446db86950c3edc88a46aa2d93736158f031fa5b 100644
--- a/xfa/fde/xml/fde_xml_imp.cpp
+++ b/xfa/fde/xml/fde_xml_imp.cpp
@@ -77,17 +77,15 @@
CFDE_XMLNode::~CFDE_XMLNode() {
DeleteChildren();
}
-
void CFDE_XMLNode::DeleteChildren() {
- CFDE_XMLNode* pChild = m_pChild;
- while (pChild) {
- CFDE_XMLNode* pNext = pChild->m_pNext;
- delete pChild;
- pChild = pNext;
- }
- m_pChild = nullptr;
-}
-
+ CFDE_XMLNode *pChild = m_pChild, *pTemp;
+ while (pChild != NULL) {
+ pTemp = pChild->m_pNext;
+ pChild->Release();
+ pChild = pTemp;
+ }
+ m_pChild = NULL;
+}
int32_t CFDE_XMLNode::CountChildNodes() const {
int32_t iCount = 0;
CFDE_XMLNode* pChild = m_pChild;
@@ -512,9 +510,6 @@
: m_wsTarget(wsTarget) {
ASSERT(m_wsTarget.GetLength() > 0);
}
-
-CFDE_XMLInstruction::~CFDE_XMLInstruction() {}
-
CFDE_XMLNode* CFDE_XMLInstruction::Clone(FX_BOOL bRecursive) {
CFDE_XMLInstruction* pClone = new CFDE_XMLInstruction(m_wsTarget);
if (!pClone) {
@@ -832,12 +827,8 @@
}
InsertChildNode(new CFDE_XMLText(wsText));
}
-
CFDE_XMLText::CFDE_XMLText(const CFX_WideString& wsText)
: CFDE_XMLNode(), m_wsText(wsText) {}
-
-CFDE_XMLText::~CFDE_XMLText() {}
-
CFDE_XMLNode* CFDE_XMLText::Clone(FX_BOOL bRecursive) {
CFDE_XMLText* pClone = new CFDE_XMLText(m_wsText);
return pClone;
@@ -845,9 +836,6 @@
CFDE_XMLCharData::CFDE_XMLCharData(const CFX_WideString& wsCData)
: CFDE_XMLDeclaration(), m_wsCharData(wsCData) {}
-
-CFDE_XMLCharData::~CFDE_XMLCharData() {}
-
CFDE_XMLNode* CFDE_XMLCharData::Clone(FX_BOOL bRecursive) {
CFDE_XMLCharData* pClone = new CFDE_XMLCharData(m_wsCharData);
return pClone;
@@ -872,19 +860,23 @@
m_pRoot->DeleteChildren();
}
} else {
- delete m_pRoot;
- m_pRoot = nullptr;
+ if (m_pRoot != NULL) {
+ m_pRoot->Release();
+ m_pRoot = NULL;
+ }
}
ReleaseParser();
}
-
void CFDE_XMLDoc::ReleaseParser() {
- delete m_pXMLParser;
- m_pXMLParser = nullptr;
- delete m_pSyntaxParser;
- m_pSyntaxParser = nullptr;
-}
-
+ if (m_pXMLParser != NULL) {
+ m_pXMLParser->Release();
+ m_pXMLParser = NULL;
+ }
+ if (m_pSyntaxParser != NULL) {
+ m_pSyntaxParser->Release();
+ m_pSyntaxParser = NULL;
+ }
+}
FX_BOOL CFDE_XMLDoc::LoadXML(IFX_Stream* pXMLStream,
int32_t iXMLPlaneSize,
int32_t iTextDataSize,
@@ -927,23 +919,21 @@
}
return TRUE;
}
-
-FX_BOOL CFDE_XMLDoc::LoadXML(IFDE_XMLParser* pXMLParser) {
- if (!pXMLParser)
+FX_BOOL CFDE_XMLDoc::LoadXML(CFDE_XMLParser* pXMLParser) {
+ if (pXMLParser == NULL) {
return FALSE;
-
+ }
Reset(TRUE);
m_pXMLParser = pXMLParser;
- return TRUE;
-}
-
+ return m_pXMLParser != NULL;
+}
int32_t CFDE_XMLDoc::DoLoad(IFX_Pause* pPause) {
if (m_iStatus >= 100) {
return m_iStatus;
}
+ ASSERT(m_pXMLParser != NULL);
return m_iStatus = m_pXMLParser->DoParser(pPause);
}
-
void CFDE_XMLDoc::CloseXML() {
ReleaseParser();
}
« no previous file with comments | « xfa/fde/xml/fde_xml_imp.h ('k') | xfa/fxfa/app/xfa_ffdoc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698