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

Unified Diff: xfa/fxfa/parser/xfa_object_imp.cpp

Issue 1981003002: Replace Release() { delete this; } in fde_xml_imp.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: One more unique_ptr 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
Index: xfa/fxfa/parser/xfa_object_imp.cpp
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp
index 0fbde1f160533dec3e74d7bcbe1ce29ef15efe9b..15b60ce3100e40b9c9311bcc2a5196770a0211df 100644
--- a/xfa/fxfa/parser/xfa_object_imp.cpp
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp
@@ -120,10 +120,10 @@ CXFA_Node::~CXFA_Node() {
delete pNode;
pNode = pNext;
}
- if (m_pXMLNode && HasFlag(XFA_NODEFLAG_OwnXMLNode)) {
- m_pXMLNode->Release();
- }
+ if (m_pXMLNode && HasFlag(XFA_NODEFLAG_OwnXMLNode))
+ delete m_pXMLNode;
}
+
CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) {
CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_eNodeClass);
@@ -962,17 +962,15 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
if (iLength >= 3) {
bOverwrite = pArguments->GetInt32(2) == 0 ? FALSE : TRUE;
}
- IXFA_Parser* pParser = IXFA_Parser::Create(m_pDocument);
- if (!pParser) {
+ std::unique_ptr<IXFA_Parser> pParser(IXFA_Parser::Create(m_pDocument));
+ if (!pParser)
Lei Zhang 2016/05/16 20:38:09 Always false, right?
Tom Sepez 2016/05/16 21:29:06 Done.
return;
- }
+
CFDE_XMLNode* pXMLNode = NULL;
int32_t iParserStatus = pParser->ParseXMLData(wsExpression, pXMLNode, NULL);
- if (iParserStatus != XFA_PARSESTATUS_Done || !pXMLNode) {
- pParser->Release();
- pParser = NULL;
+ if (iParserStatus != XFA_PARSESTATUS_Done || !pXMLNode)
return;
- }
+
if (bIgnoreRoot &&
(pXMLNode->GetType() != FDE_XMLNODE_Element ||
XFA_RecognizeRichText(static_cast<CFDE_XMLElement*>(pXMLNode)))) {
@@ -1059,14 +1057,11 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
}
pFakeRoot->SetFlag(XFA_NODEFLAG_HasRemoved, false);
} else {
- if (pFakeXMLRoot) {
- pFakeXMLRoot->Release();
- pFakeXMLRoot = NULL;
- }
+ delete pFakeXMLRoot;
Lei Zhang 2016/05/16 20:38:09 Can this be an unique_ptr?
Tom Sepez 2016/05/16 21:29:06 Maybe later. This gets assigned in a couple of pl
+ pFakeXMLRoot = nullptr;
}
- pParser->Release();
- pParser = NULL;
}
+
void CXFA_Node::Script_NodeClass_SaveFilteredXML(CFXJSE_Arguments* pArguments) {
}

Powered by Google App Engine
This is Rietveld 408576698