sw/source/core/layout/calcmove.cxx | 3 +++ 1 file changed, 3 insertions(+)
New commits: commit 0bfed8ac8f88f434081aa0694933419c77573b28 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Aug 8 19:39:04 2023 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Aug 16 11:14:02 2023 +0200 tdf#151866 sw: layout: prevent deleting newly created SwSectionFrame A section frame is created so that content can move back from another page into it. Apparently only the pPrv frame is on the same page, and formatting it in SwFrame::MakePos() moves it backward, then CheckPageDescs() sees a page with only empty section frames on it and deletes the whole page. (regression from commit b9ef71476fd70bc13f50ebe80390e0730d1b7afb) Change-Id: I4f8e4debd4bcf993c9355dcfc3ced779fe6732ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155467 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 2f9e67d1e70bdc45dfc59554547bc3730481a757) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155475 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 184373585928..73b72d03305c 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -542,6 +542,9 @@ void SwFrame::MakePos() !pPrv->GetAttrSet()->GetKeep().GetValue() ) { + // tdf#151866 pPrv may MoveBwd and if this is a newly created + // section frame then CheckPageDescs() may delete the whole page! + SwFrameDeleteGuard g(this); // Prevent it. pPrv->Calc(getRootFrame()->GetCurrShell() ? getRootFrame()->GetCurrShell()->GetOut() : nullptr); // This may cause Prev to vanish! } else if ( pPrv->getFrameArea().Top() == 0 )