summaryrefslogtreecommitdiff
path: root/xfa/fde/xml/fde_xml_imp.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-05-16 15:56:53 -0700
committerTom Sepez <tsepez@chromium.org>2016-05-16 15:56:53 -0700
commitd3743ea4e62e870724be26d423c90204c8639463 (patch)
treef54ee0cd640a9480341844dac86a4178892c94e5 /xfa/fde/xml/fde_xml_imp.cpp
parentfa34e805fd03ba81bcfe1148cf96b24fe63b39a0 (diff)
downloadpdfium-d3743ea4e62e870724be26d423c90204c8639463.tar.xz
Revert "Replace Release() { delete this; } in fde_xml_imp.h"
This reverts commit fa34e805fd03ba81bcfe1148cf96b24fe63b39a0. Reason for revert: broke asan tests. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1982843002 .
Diffstat (limited to 'xfa/fde/xml/fde_xml_imp.cpp')
-rw-r--r--xfa/fde/xml/fde_xml_imp.cpp56
1 files changed, 23 insertions, 33 deletions
diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp
index f630a8995e..446db86950 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()
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;
+ CFDE_XMLNode *pChild = m_pChild, *pTemp;
+ while (pChild != NULL) {
+ pTemp = pChild->m_pNext;
+ pChild->Release();
+ pChild = pTemp;
}
- m_pChild = nullptr;
+ m_pChild = NULL;
}
-
int32_t CFDE_XMLNode::CountChildNodes() const {
int32_t iCount = 0;
CFDE_XMLNode* pChild = m_pChild;
@@ -512,9 +510,6 @@ CFDE_XMLInstruction::CFDE_XMLInstruction(const CFX_WideString& wsTarget)
: 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 @@ void CFDE_XMLElement::SetTextData(const CFX_WideString& wsText) {
}
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_XMLNode* CFDE_XMLText::Clone(FX_BOOL bRecursive) {
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 @@ void CFDE_XMLDoc::Reset(FX_BOOL bInitRoot) {
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 @@ FX_BOOL CFDE_XMLDoc::LoadXML(IFX_Stream* pXMLStream,
}
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();
}