msxml3: Use orphan node list.
This commit is contained in:
parent
e497ed823e
commit
f229469de3
|
@ -953,6 +953,7 @@ static HRESULT WINAPI domdoc_createElement(
|
|||
|
||||
xml_name = xmlChar_from_wchar((WCHAR*)tagname);
|
||||
xmlnode = xmlNewDocNode(get_doc(This), NULL, xml_name, NULL);
|
||||
xmldoc_add_orphan(xmlnode->doc, xmlnode);
|
||||
|
||||
TRACE("created xmlptr %p\n", xmlnode);
|
||||
elem_unk = create_element(xmlnode, NULL);
|
||||
|
@ -984,6 +985,7 @@ static HRESULT WINAPI domdoc_createDocumentFragment(
|
|||
if(!xmlnode)
|
||||
return E_FAIL;
|
||||
|
||||
xmldoc_add_orphan(xmlnode->doc, xmlnode);
|
||||
*docFrag = (IXMLDOMDocumentFragment*)create_doc_fragment(xmlnode);
|
||||
|
||||
return S_OK;
|
||||
|
@ -1014,6 +1016,7 @@ static HRESULT WINAPI domdoc_createTextNode(
|
|||
return E_FAIL;
|
||||
|
||||
xmlnode->doc = get_doc( This );
|
||||
xmldoc_add_orphan(xmlnode->doc, xmlnode);
|
||||
|
||||
*text = (IXMLDOMText*)create_text(xmlnode);
|
||||
|
||||
|
@ -1045,6 +1048,7 @@ static HRESULT WINAPI domdoc_createComment(
|
|||
return E_FAIL;
|
||||
|
||||
xmlnode->doc = get_doc( This );
|
||||
xmldoc_add_orphan(xmlnode->doc, xmlnode);
|
||||
|
||||
*comment = (IXMLDOMComment*)create_comment(xmlnode);
|
||||
|
||||
|
@ -1076,6 +1080,7 @@ static HRESULT WINAPI domdoc_createCDATASection(
|
|||
return E_FAIL;
|
||||
|
||||
xmlnode->doc = get_doc( This );
|
||||
xmldoc_add_orphan(xmlnode->doc, xmlnode);
|
||||
|
||||
*cdata = (IXMLDOMCDATASection*)create_cdata(xmlnode);
|
||||
|
||||
|
@ -1106,6 +1111,7 @@ static HRESULT WINAPI domdoc_createProcessingInstruction(
|
|||
xml_content = xmlChar_from_wchar((WCHAR*)data);
|
||||
|
||||
xmlnode = xmlNewDocPI(get_doc(This), xml_target, xml_content);
|
||||
xmldoc_add_orphan(xmlnode->doc, xmlnode);
|
||||
TRACE("created xmlptr %p\n", xmlnode);
|
||||
*pi = (IXMLDOMProcessingInstruction*)create_pi(xmlnode);
|
||||
|
||||
|
@ -1144,6 +1150,7 @@ static HRESULT WINAPI domdoc_createAttribute(
|
|||
return E_FAIL;
|
||||
|
||||
xmlnode->doc = get_doc( This );
|
||||
xmldoc_add_orphan(xmlnode->doc, xmlnode);
|
||||
|
||||
*attribute = (IXMLDOMAttribute*)create_attribute(xmlnode);
|
||||
|
||||
|
@ -1175,6 +1182,7 @@ static HRESULT WINAPI domdoc_createEntityReference(
|
|||
return E_FAIL;
|
||||
|
||||
xmlnode->doc = get_doc( This );
|
||||
xmldoc_add_orphan(xmlnode->doc, xmlnode);
|
||||
|
||||
*entityRef = (IXMLDOMEntityReference*)create_doc_entity_ref(xmlnode);
|
||||
|
||||
|
@ -1267,7 +1275,10 @@ static HRESULT WINAPI domdoc_createNode(
|
|||
HeapFree(GetProcessHeap(), 0, xml_name);
|
||||
|
||||
if(xmlnode && *node)
|
||||
{
|
||||
xmldoc_add_orphan(xmlnode->doc, xmlnode);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
|
|
|
@ -596,6 +596,10 @@ static HRESULT WINAPI xmlnode_insertBefore(
|
|||
new_child_node = impl_from_IXMLDOMNode(new)->node;
|
||||
TRACE("new_child_node %p This->node %p\n", new_child_node, This->node);
|
||||
|
||||
if(!new_child_node->parent)
|
||||
if(xmldoc_remove_orphan(new_child_node->doc, new_child_node) != S_OK)
|
||||
WARN("%p is not an orphan of %p\n", new_child_node, new_child_node->doc);
|
||||
|
||||
if(before)
|
||||
{
|
||||
before_node = impl_from_IXMLDOMNode(before)->node;
|
||||
|
@ -663,11 +667,17 @@ static HRESULT WINAPI xmlnode_replaceChild(
|
|||
my_ancestor = my_ancestor->parent;
|
||||
}
|
||||
|
||||
if(!new_child_ptr->parent)
|
||||
if(xmldoc_remove_orphan(new_child_ptr->doc, new_child_ptr) != S_OK)
|
||||
WARN("%p is not an orphan of %p\n", new_child_ptr, new_child_ptr->doc);
|
||||
|
||||
leaving_doc = new_child_ptr->doc;
|
||||
xmldoc_add_ref(old_child_ptr->doc);
|
||||
xmlReplaceNode(old_child_ptr, new_child_ptr);
|
||||
xmldoc_release(leaving_doc);
|
||||
|
||||
xmldoc_add_orphan(old_child_ptr->doc, old_child_ptr);
|
||||
|
||||
if(outOldChild)
|
||||
{
|
||||
IXMLDOMNode_AddRef(oldChild);
|
||||
|
@ -790,6 +800,7 @@ static HRESULT WINAPI xmlnode_cloneNode(
|
|||
if(pClone)
|
||||
{
|
||||
pClone->doc = This->node->doc;
|
||||
xmldoc_add_orphan(pClone->doc, pClone);
|
||||
|
||||
pNode = create_node(pClone);
|
||||
if(!pNode)
|
||||
|
|
|
@ -265,6 +265,10 @@ static HRESULT WINAPI xmlnodemap_setNamedItem(
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(!ThisNew->node->parent)
|
||||
if(xmldoc_remove_orphan(ThisNew->node->doc, ThisNew->node) != S_OK)
|
||||
WARN("%p is not an orphan of %p\n", ThisNew->node, ThisNew->node->doc);
|
||||
|
||||
nodeNew = xmlAddChild(node, ThisNew->node);
|
||||
|
||||
if(namedItem)
|
||||
|
@ -312,6 +316,8 @@ static HRESULT WINAPI xmlnodemap_removeNamedItem(
|
|||
{
|
||||
attr_copy = xmlCopyProp( NULL, attr );
|
||||
attr_copy->doc = node->doc;
|
||||
/* The cast here is OK, xmlFreeNode handles xmlAttrPtr pointers */
|
||||
xmldoc_add_orphan(attr_copy->doc, (xmlNodePtr) attr_copy);
|
||||
*namedItem = create_node( (xmlNodePtr) attr_copy );
|
||||
}
|
||||
xmlRemoveProp( attr );
|
||||
|
|
Loading…
Reference in New Issue