sw/source/core/layout/flycnt.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit a7548d6b38a9b075f31f5955d1512d9ff5017d66
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Jun 7 13:59:04 2024 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Jun 11 14:27:25 2024 +0200

    tdf#161217 sw: layout: don't move into to-be-deleted section frame
    
    The problem is that in SwFrame::GetNextFlyLeaf() pLayLeaf is found
    inside a SwSectionFrame that has no m_pSection because it has been
    scheduled for deletion via SwRootFrame::InsertEmptySct().
    
    Skip such frames, now it goes into infinite loop later...
    
    Change-Id: I93e5febba19213c1503fd699c8e4517067c6ec6b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168528
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit e607bf096d4fb182388ccaefb1179cdd924af02a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168535
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 7d4e4ca70218..61ffc387a6da 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -1662,7 +1662,13 @@ SwLayoutFrame *SwFrame::GetNextFlyLeaf( MakePageType 
eMakePage )
             {
                 // The above conditions are not held, reject.
                 pOldLayLeaf = pLayLeaf;
-                pLayLeaf = pLayLeaf->GetNextLayoutLeaf();
+                do
+                {
+                    pLayLeaf = pLayLeaf->GetNextLayoutLeaf();
+                }
+                // skip deleted section frames - do not move into these
+                while (pLayLeaf && pLayLeaf->FindSctFrame()
+                    && !pLayLeaf->FindSctFrame()->GetSection());
 
                 if (pLayLeaf && pLayLeaf->IsInDocBody() && !bSameBody && 
!pLayLeaf->IsInFly() && pLayLeaf->IsInTab())
                 {

Reply via email to