summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
Diffstat (limited to 'sax')
-rw-r--r--sax/source/tools/fshelper.cxx20
1 files changed, 18 insertions, 2 deletions
diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx
index 7cbd3c36abc1..fbf7f0672709 100644
--- a/sax/source/tools/fshelper.cxx
+++ b/sax/source/tools/fshelper.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/log.hxx>
#include <sax/fshelper.hxx>
#include "fastserializer.hxx"
@@ -29,12 +30,27 @@ FastSerializerHelper::FastSerializerHelper(const Reference< io::XOutputStream >&
mpSerializer(new FastSaxSerializer(xOutputStream))
{
if( bWriteHeader )
- mpSerializer->startDocument();
+ startDocument();
+}
+
+void FastSerializerHelper::startDocument()
+{
+ mpSerializer->startDocument();
+}
+
+void FastSerializerHelper::endDocument()
+{
+ std::unique_ptr<FastSaxSerializer> xSerializer(std::move(mpSerializer));
+ xSerializer->endDocument();
}
FastSerializerHelper::~FastSerializerHelper()
{
- mpSerializer->endDocument();
+ if (mpSerializer)
+ {
+ assert(false && "call endDocument explicitly before dtor to avoid potential exceptions during dtor");
+ endDocument();
+ }
}
void FastSerializerHelper::startElement(sal_Int32 elementTokenId)