summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-07-07 14:48:46 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-07-07 14:48:46 +0000
commite22d38a150ab9ca449bf2434676e0be7561308bd (patch)
tree1b7309e088024f7abbac6746483f7d109591a2be
parent813cabb5e67bab646a838890fa55363ad566ee11 (diff)
traverse() function is now foolproof against walkers that modify node handles
git-svn-id: http://pugixml.googlecode.com/svn/trunk@568 99668b35-9821-0410-8761-19e4c4f06640
-rw-r--r--src/pugixml.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 3362e05..c84ad2a 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -3945,7 +3945,8 @@ namespace pugi
{
walker._depth = -1;
- if (!walker.begin(*this)) return false;
+ xml_node arg_begin = *this;
+ if (!walker.begin(arg_begin)) return false;
xml_node cur = first_child();
@@ -3955,7 +3956,8 @@ namespace pugi
do
{
- if (!walker.for_each(cur))
+ xml_node arg_for_each = cur;
+ if (!walker.for_each(arg_for_each))
return false;
if (cur.first_child())
@@ -3983,7 +3985,8 @@ namespace pugi
assert(walker._depth == -1);
- return walker.end(*this);
+ xml_node arg_end = *this;
+ return walker.end(arg_end);
}
unsigned int xml_node::document_order() const