[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[xml] Patch for xmlReplaceNode in tree.c



Hi all,

I see a problem with
http://cvs.gnome.org/lxr/source/gnome-xml/tree.c#2595
(yes, exactly that line).

The problem is that this does not set the doc pointer
for all child/property nodes of the node that replaces
the old node.

This might be also a problem since xmlSetTreeDoc() does
"deep" setting of the doc pointer only if the tree root node
has a doc pointer different from the new doc pointer.
See:
http://cvs.gnome.org/lxr/source/gnome-xml/tree.c#1804

I had crashes that indicate wrong doc pointers in nodes
after using xmlReplaceNode().

Patch attached.

Thank you,
Jurij Rosenthal
--- tree.c.orig	Tue Mar 26 20:19:32 2002
+++ tree.c	Tue Mar 26 20:22:09 2002
@@ -2592,7 +2592,10 @@
 	return(old);
     }
     xmlUnlinkNode(cur);
-    cur->doc = old->doc;
+
+    if( cur->doc != old->doc )
+		xmlSetTreeDoc(cur, old->doc);
+
     cur->parent = old->parent;
     cur->next = old->next;
     if (cur->next != NULL)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]