svl/source/undo/undo.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+)
New commits: commit 9460d24883067160c53b53a018a88298131908da Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Aug 3 18:35:57 2016 +0200 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 <vmik...@collabora.co.uk> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx index e9b2c06..1caf382 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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits