Nikolay Sivov : msxml3: Update refcount in replaceNode().

Alexandre Julliard julliard at winehq.org
Wed Feb 27 14:41:58 CST 2013


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Feb 25 15:36:56 2013 +0400

msxml3: Update refcount in replaceNode().

---

 dlls/msxml3/node.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index 8571955..20f9ba9 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -511,6 +511,7 @@ HRESULT node_replace_child(xmlnode *This, IXMLDOMNode *newChild, IXMLDOMNode *ol
     xmlnode *old_child, *new_child;
     xmlDocPtr leaving_doc;
     xmlNode *my_ancestor;
+    int refcount = 0;
 
     /* Do not believe any documentation telling that newChild == NULL
        means removal. It does certainly *not* apply to msxml3! */
@@ -548,9 +549,13 @@ HRESULT node_replace_child(xmlnode *This, IXMLDOMNode *newChild, IXMLDOMNode *ol
             WARN("%p is not an orphan of %p\n", new_child->node, new_child->node->doc);
 
     leaving_doc = new_child->node->doc;
-    xmldoc_add_ref(old_child->node->doc);
+
+    if (leaving_doc != old_child->node->doc)
+        refcount = xmlnode_get_inst_cnt(new_child);
+
+    if (refcount) xmldoc_add_refs(old_child->node->doc, refcount);
     xmlReplaceNode(old_child->node, new_child->node);
-    xmldoc_release(leaving_doc);
+    if (refcount) xmldoc_release_refs(leaving_doc, refcount);
     new_child->parent = old_child->parent;
     old_child->parent = NULL;
 




More information about the wine-cvs mailing list