diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2024-06-07 14:16:23 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-06-07 18:04:19 +0200 |
commit | 724c17602fac7476f068e6b66f30e9ef3c9f0940 (patch) | |
tree | 982aa1a97d37317e1532abfffc1f571a93e32f34 | |
parent | e607bf096d4fb182388ccaefb1179cdd924af02a (diff) |
tdf#161215 sw: layout: don't move into section frame on same page
The problem is that in SwFrame::GetNextFlyLeaf() pLayLeaf is in the body
on the same page as pFlyAnchor, so the MoveSubTree() effectively removes
the pNext chain from the layout into a circular structure whose upper is
an indirect lower, causing an infinite loop later.
Change-Id: I08f96cf483205d6213d7cec7b239f750fff5d3ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168529
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r-- | sw/source/core/layout/flycnt.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 89cd2e0bb876..03d95c979f11 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -1629,7 +1629,17 @@ SwLayoutFrame *SwFrame::GetNextFlyLeaf( MakePageType eMakePage ) { // Make sure the candidate is not inside the same body frame, that would prevent // inserting a new page. - if (pFlyAnchor->FindBodyFrame() == pLayLeaf->FindBodyFrame()) + SwBodyFrame const* pAnchorBody(pFlyAnchor->FindBodyFrame()); + while (!pAnchorBody->IsPageBodyFrame()) + { + pAnchorBody = pAnchorBody->GetUpper()->FindBodyFrame(); + }; + SwBodyFrame const* pLeafBody(pLayLeaf->FindBodyFrame()); + while (!pLeafBody->IsPageBodyFrame()) + { + pLeafBody = pLeafBody->GetUpper()->FindBodyFrame(); + }; + if (pAnchorBody == pLeafBody) { bSameBody = true; } |