summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-04-14 19:11:26 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-04-14 19:11:26 -0700
commit2badcbb6743ff803c9cd82db77a1d8a50802058f (patch)
tree83d6753d930ea72bec96158b358433573a5ffae1
parente977f04fe221d56bac2f0f18d81a1934f6754cb5 (diff)
Explicitly call xml_buffered_writer::flush()
If xml_writer::write throws an exception while being called from flush(), the exception is thrown from destructor. Clang in C++11 mode calls std::terminate in this case.
-rw-r--r--src/pugixml.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 590d07f..1c1b539 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -3115,11 +3115,6 @@ PUGI__NS_BEGIN
PUGI__STATIC_ASSERT(bufcapacity >= 8);
}
- ~xml_buffered_writer()
- {
- flush();
- }
-
size_t flush()
{
flush(buffer, bufsize);
@@ -5496,6 +5491,8 @@ namespace pugi
impl::xml_buffered_writer buffered_writer(writer, encoding);
impl::node_output(buffered_writer, _root, indent, flags, depth);
+
+ buffered_writer.flush();
}
#ifndef PUGIXML_NO_STL
@@ -6205,6 +6202,8 @@ namespace pugi
}
impl::node_output(buffered_writer, _root, indent, flags, 0);
+
+ buffered_writer.flush();
}
#ifndef PUGIXML_NO_STL