From e40678ed8a22ecd57421877af39cf7f281f618c4 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 15 Feb 2018 18:12:29 +0000 Subject: Make the CFX_XMLNode a MaybeOwned pointer This CL removes the HasOwnXML flag from the CXFA_Node objects and instead uses a MaybeOwned pointer to keep track of the XML nodes. Change-Id: Ie678258247ec21ecb15c639647b189e140586d25 Reviewed-on: https://pdfium-review.googlesource.com/26811 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- fxjs/xfa/cjx_node.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'fxjs/xfa') diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp index 9b5d4044ea..1343d258e1 100644 --- a/fxjs/xfa/cjx_node.cpp +++ b/fxjs/xfa/cjx_node.cpp @@ -7,6 +7,7 @@ #include "fxjs/xfa/cjx_node.h" #include +#include #include #include "core/fxcrt/cfx_memorystream.h" @@ -288,8 +289,8 @@ CJS_Return CJX_Node::loadXML(CFX_V8* runtime, if (GetXFANode()->GetPacketType() == XFA_PacketType::Form && GetXFANode()->GetElementType() == XFA_Element::ExData) { CFX_XMLNode* pTempXMLNode = GetXFANode()->GetXMLMappingNode(); - GetXFANode()->SetXMLMappingNode(pFakeXMLRoot.release()); - GetXFANode()->SetFlag(XFA_NodeFlag_OwnXMLNode); + GetXFANode()->SetXMLMappingNode(std::move(pFakeXMLRoot)); + if (pTempXMLNode && !pTempXMLNode->GetParent()) pFakeXMLRoot.reset(pTempXMLNode); else @@ -308,8 +309,7 @@ CJS_Return CJX_Node::loadXML(CFX_V8* runtime, } if (pFakeXMLRoot) { - pFakeRoot->SetXMLMappingNode(pFakeXMLRoot.release()); - pFakeRoot->SetFlag(XFA_NodeFlag_OwnXMLNode); + pFakeRoot->SetXMLMappingNode(std::move(pFakeXMLRoot)); } pFakeRoot->SetFlag(XFA_NodeFlag_HasRemovedChildren); -- cgit v1.2.3