sw/source/core/layout/flowfrm.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5af29292af4564357b18610467d69ac35ad8271c
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu May 11 19:01:53 2023 +0200
Commit:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
CommitDate: Wed May 17 14:01:07 2023 +0200

    tdf#144494 sw: fix layout loop
    
    There is a pre-existing loop here, where page 1 is layouted, the text
    frame splits due to the fly taking up space, page 2 is layouted, the fly
    moves to page 2 (invalidating page 1) and thus the text frame splits
    again, page 1 is layouted, happy to see all the free space, and joins all
    its follows.
    
    Previously this was eventually terminated by layact.cxx:639 calling
    SwLayouter::LoopControl() and this force-validates page 1, resulting in
    page 1 having the fly (which is actually anchored at the end of the text
    frame, on page 2).
    
    Now the CheckPageDescs() discovers that page 3 doesn't have any content,
    and deletes it; this causes it to be re-created on every iteration of
    the loop and somehow the SwLayouter now doesn't detect the loop.
    
    But the call that deletes the page 3 is actually unnecessary: the text
    frame does have a SwPageDescItem - but it is itself a follow, where
    break items doesn't matter anyway - so just check for this to get back
    to the previous layout result.
    
    (regression from commit b9ef71476fd70bc13f50ebe80390e0730d1b7afb)
    
    Change-Id: If15c31278bd36e51c64090a288e8bd1ab6753dd7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151680
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit ac9500105cc72d84ce120fd1dc125329aadb63a0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151618
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index 538cb2b8f35c..370ad84b88ff 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -2129,7 +2129,7 @@ bool SwFlowFrame::MoveFwd( bool bMakePage, bool 
bPageBreak, bool bMoveAlways )
             // i#106452
             // check page description not only in situation with sections.
             if ( !bSamePage &&
-                 ( m_rThis.GetPageDescItem().GetPageDesc() ||
+                 ((!IsFollow() && m_rThis.GetPageDescItem().GetPageDesc()) ||
                    pOldPage->GetPageDesc()->GetFollow() != 
pNewPage->GetPageDesc() ) )
             {
                 SwFrame::CheckPageDescs( pNewPage, false );

Reply via email to