diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-03 18:35:57 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-03 18:02:37 +0000 |
commit | 9460d24883067160c53b53a018a88298131908da (patch) | |
tree | 9c7aa9fee7be8501294a5a7ec4a37a766fa77aae /svl | |
parent | b7cb6546d12c9a887e20b8ee19398d11c060394a (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>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/undo/undo.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx index e9b2c0681a8d..1caf382a8bec 100644 --- a/svl/source/undo/undo.cxx +++ b/svl/source/undo/undo.cxx @@ -1254,6 +1254,14 @@ void SfxUndoManager::RemoveOldestUndoAction() 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())); @@ -1261,6 +1269,11 @@ void SfxUndoManager::dumpAsXml(xmlTextWriterPtr pWriter) const GetUndoAction(i)->dumpAsXml(pWriter); xmlTextWriterEndElement(pWriter); + if (bOwns) + { + xmlTextWriterEndDocument(pWriter); + xmlFreeTextWriter(pWriter); + } } struct SfxListUndoAction::Impl |