summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-08-03 18:35:57 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-08-04 11:10:05 +0200
commited91412a2f12f59d98575ccd1baa8bbf06d71896 (patch)
tree5a4c583a835f74e537cc75c2ebe84685061073ee
parent45e01b368e39069151f235b7d4954da1b76c9ffd (diff)
svl: handle nullptr pWriter in SfxUndoManager::dumpAsXml()
This is useful when it's called from gdb for Calc. Change-Id: I22b3e5bbfc5627bff27899a288f7c25179f750ec Reviewed-on: https://gerrit.libreoffice.org/27836 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 9460d24883067160c53b53a018a88298131908da)
-rw-r--r--svl/source/undo/undo.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index 154e8e9ee8fb..def0089a00e2 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -1285,6 +1285,14 @@ void SfxUndoManager::RemoveOldestUndoActions( size_t const i_count )
void SfxUndoManager::dumpAsXml(xmlTextWriterPtr pWriter) const
{
+ bool bOwns = false;
+ if (!pWriter)
+ {
+ pWriter = xmlNewTextWriterFilename("undo.xml", 0);
+ xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
+ bOwns = true;
+ }
+
xmlTextWriterStartElement(pWriter, BAD_CAST("sfxUndoManager"));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nUndoActionCount"), BAD_CAST(OString::number(GetUndoActionCount()).getStr()));
@@ -1292,6 +1300,11 @@ void SfxUndoManager::dumpAsXml(xmlTextWriterPtr pWriter) const
GetUndoAction(i)->dumpAsXml(pWriter);
xmlTextWriterEndElement(pWriter);
+ if (bOwns)
+ {
+ xmlTextWriterEndDocument(pWriter);
+ xmlFreeTextWriter(pWriter);
+ }
}
struct SfxListUndoAction::Impl