diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-06-13 15:59:12 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-06-14 15:13:30 +0200 |
commit | c935e6d68c06e50fb8de81a8497b4d9a9c5dda1f (patch) | |
tree | c77b7099dda0613baa9d68c5fde48c36892bacad /sw | |
parent | 1c9e7e9342612f9db59eb8b2d6dc28d475459e34 (diff) |
tdf#149507 sw: don't delete bookmarks in SwUndoInsLayFormat::UndoImpl()
The problem is that the CorrAbs() here deletes the bookmarks in the fly,
and this isn't supposed to happen at this point, because DelFly() will
call SaveSection(), which saves the bookmarks in the m_pHistory via
DelContentIndex(), so that they can be re-inserted in Redo/InsFly().
Also change the code that was inserted in commit
0ee28fdf3e9a0bd8763eda6299af1d5c873a9dcf to not call CorrAbs().
(although this bug has existed forever, crashing is a regression from
commit 657de5fba12b0e9afcdee361654d2a2d0dbd7311)
Change-Id: Iabac0ccf5587d5d974e88cbbc3e05bbaed3526f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135728
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 6de844c5da695bf4605bef5510d33e74a7ff04ee)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135750
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/undo/undobj1.cxx | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index fa88f6179442..22eefa8a55a4 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -36,6 +36,7 @@ #include <rootfrm.hxx> #include <swundo.hxx> #include <pam.hxx> +#include <mvsave.hxx> #include <ndtxt.hxx> #include <ndole.hxx> #include <frameformats.hxx> @@ -295,7 +296,6 @@ void SwUndoInsLayFormat::UndoImpl(::sw::UndoRedoContext & rContext) if( rContent.GetContentIdx() ) // no content { assert(&rContent.GetContentIdx()->GetNodes() == &rDoc.GetNodes()); - bool bRemoveIdx = true; if( mnCursorSaveIndexPara > SwNodeOffset(0) ) { SwTextNode *const pNode = @@ -308,14 +308,11 @@ void SwUndoInsLayFormat::UndoImpl(::sw::UndoRedoContext & rContext) aIdx.GetNode().EndOfSectionIndex() ); SwIndex aIndex( pNode, mnCursorSaveIndexPos ); SwPosition aPos( *pNode, aIndex ); - SwDoc::CorrAbs( aIdx, aEndIdx, aPos, true ); - bRemoveIdx = false; + // don't delete bookmarks here, DelFly() will save them in history + ::PaMCorrAbs(SwPaM(aIdx, aEndIdx), aPos); + // TODO: is aPos actually a sensible pos for e.g. SwXText* ? } } - if( bRemoveIdx ) - { - RemoveIdxFromSection( rDoc, rContent.GetContentIdx()->GetIndex() ); - } } DelFly(& rDoc); } |