sw/source/core/undo/undobj1.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
New commits: commit c935e6d68c06e50fb8de81a8497b4d9a9c5dda1f Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Mon Jun 13 15:59:12 2022 +0200 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Jun 14 15:13:30 2022 +0200 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.st...@allotropia.de> (cherry picked from commit 6de844c5da695bf4605bef5510d33e74a7ff04ee) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135750 Reviewed-by: Caolán McNamara <caol...@redhat.com> 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); }