Nikolay Sivov : msxml3: Remove child node in one place in node_insert_before().

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 20 15:20:10 CST 2015


Module: wine
Branch: master
Commit: fd925d0e5b477f8b99260596b88b33a85770cf07
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fd925d0e5b477f8b99260596b88b33a85770cf07

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sat Jan 17 20:22:48 2015 +0300

msxml3: Remove child node in one place in node_insert_before().

---

 dlls/msxml3/node.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index 47d3159..92063be 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -477,15 +477,19 @@ HRESULT node_insert_before(xmlnode *This, IXMLDOMNode *new_child, const VARIANT
         xmlnode *before_node_obj = get_node_obj(before);
         IXMLDOMNode_Release(before);
         if(!before_node_obj) return E_FAIL;
+    }
 
-        /* unlink from current parent first */
-        if(node_obj->parent)
-        {
-            hr = IXMLDOMNode_removeChild(node_obj->parent, node_obj->iface, NULL);
-            if (hr == S_OK) xmldoc_remove_orphan(node_obj->node->doc, node_obj->node);
-        }
+    /* unlink from current parent first */
+    if(node_obj->parent)
+    {
+        hr = IXMLDOMNode_removeChild(node_obj->parent, node_obj->iface, NULL);
+        if (hr == S_OK) xmldoc_remove_orphan(node_obj->node->doc, node_obj->node);
+    }
+    doc = node_obj->node->doc;
 
-        doc = node_obj->node->doc;
+    if(before)
+    {
+        xmlnode *before_node_obj = get_node_obj(before);
 
         /* refs count including subtree */
         if (doc != before_node_obj->node->doc)
@@ -498,14 +502,6 @@ HRESULT node_insert_before(xmlnode *This, IXMLDOMNode *new_child, const VARIANT
     }
     else
     {
-        /* unlink from current parent first */
-        if(node_obj->parent)
-        {
-            hr = IXMLDOMNode_removeChild(node_obj->parent, node_obj->iface, NULL);
-            if (hr == S_OK) xmldoc_remove_orphan(node_obj->node->doc, node_obj->node);
-        }
-        doc = node_obj->node->doc;
-
         if (doc != This->node->doc)
             refcount = xmlnode_get_inst_cnt(node_obj);
 




More information about the wine-cvs mailing list