sw/source/core/undo/undobj1.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
New commits: commit a5e9e27b4f7ff6fc10b091724c6c0849964ebf11 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:14:03 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 61161db6955dddde687425651d7858c6f89051a4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135749 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 846311867e0d..fb624d68d6b0 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); }