From 2b4ad9ff5bf1727d12ef2bcce7e3fa925bbe8978 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 9 Apr 2018 16:14:55 +0000 Subject: Remove CXFA nodes instead of CFX_XML nodes When we set data into the CJX nodes, we need to update the backing store of the XFA nodes, which are the XML nodes. When we update the backing store, there are cases where we need to remove the children (setting CData on a node or setting the value of an Attribute which is backed by a real node). Currently we call DeleteChildren on the XML node. This causes issues when we cleanup the tree as XFA nodes may point to these deleted XML nodes. Instead, this CL cleans up the XFA nodes which will in turn clean up the XML nodes. This seems like the right thing to do as we no longer have the backing nodes, so we should no longer have the XFA nodes on top of them. Bug: chromium:813155 Change-Id: I63d53fd56999ec9d3b3af2ab5952b374663f040c Reviewed-on: https://pdfium-review.googlesource.com/29950 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_node.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 3823d2eae0..7122d95bff 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -4678,8 +4678,10 @@ void CXFA_Node::SetToXML(const WideString& value) { } } } - if (bDeleteChildren) - elem->DeleteChildren(); + if (bDeleteChildren) { + while (auto* child = GetLastChild()) + RemoveChild(child, false); + } elem->SetTextData(value); break; -- cgit v1.2.3