tdf#98512: sw: remove duplicate undo history add

Desktop / LibreOffice - Michael Stahl [redhat.com] - 29 April 2016 17:21 UTC

Follow-up to commit ed81bf39dd3431d28860fed6a2d4e8814126cc61.

In almost all cases SetAttr() and InsertHint() will already add the history hint themselves, so this code in SwRegHistory::InsertItems() looks somewhat pointless as it inserts a duplicate.

It turns out it's needed for hints that insert dummy characters, because firstly for the hints-without-end the NoteInHistory() was not called, and secondly when InsertText() inserts the dummy character it may actually delete the hints array if there are no pre-existing hints, and a new hints array will be created where the SwRegHistory isn't registered.

It's not obvious how the hints array actually can become empty in SwTextNode::InsertText().

Let's fix that and assert instead that the history hint was inserted.

b44e70e tdf#98512: sw: remove duplicate undo history add
sw/source/core/txtnode/ndtxt.cxx | 3 ++-
sw/source/core/txtnode/thints.cxx | 1 +
sw/source/core/undo/rolbck.cxx | 33 +++++++++++++++++++++++----------
3 files changed, 26 insertions(+), 11 deletions(-)

Upstream: cgit.freedesktop.org


  • Share