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>
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index 8463118..fb624d6 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);
}