msxml3: Update orphaned list in put_documentElement.

This commit is contained in:
Jacek Caban 2008-10-16 13:55:41 -05:00 committed by Alexandre Julliard
parent dee8657be4
commit e7ff101996
1 changed files with 10 additions and 1 deletions

View File

@ -922,6 +922,7 @@ static HRESULT WINAPI domdoc_put_documentElement(
{
domdoc *This = impl_from_IXMLDOMDocument2( iface );
IXMLDOMNode *elementNode;
xmlNodePtr oldRoot;
xmlnode *xmlNode;
HRESULT hr;
@ -932,9 +933,17 @@ static HRESULT WINAPI domdoc_put_documentElement(
return hr;
xmlNode = impl_from_IXMLDOMNode( elementNode );
xmlDocSetRootElement( get_doc(This), xmlNode->node);
if(!xmlNode->node->parent)
if(xmldoc_remove_orphan(xmlNode->node->doc, xmlNode->node) != S_OK)
WARN("%p is not an orphan of %p\n", xmlNode->node->doc, xmlNode->node);
oldRoot = xmlDocSetRootElement( get_doc(This), xmlNode->node);
IXMLDOMNode_Release( elementNode );
if(oldRoot)
xmldoc_add_orphan(oldRoot->doc, oldRoot);
return S_OK;
}