sw/source/core/draw/dcontact.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 2d0874e09c7557fee9b5e22c4a933b73fa4827ff
Author:     Mike Kaganski <[email protected]>
AuthorDate: Fri Jul 14 18:51:41 2023 +0300
Commit:     Mike Kaganski <[email protected]>
CommitDate: Fri Nov 29 10:36:54 2024 +0500

    tdf#156287: don't try to move objects to pages other than their anchor
    
    Objects may have offset moving them outside of the current page, where
    their anchor is. This doesn't mean that they would move to another page,
    just that they will be clipped.
    
    Without this taken into account, objects which rectangle would be on
    another page, would trigger infinite loop because of their position
    invalidation in SwLayAction::FormatContent's cleanup code, where they
    will move to their correct page; and then their off-page rectangle
    would move them to another page again.
    
    Change-Id: I2b818403163041a49a3bc1640b1af9a1705fd671
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154444
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index ded538c55cdc..cf360a81914c 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -2056,10 +2056,12 @@ void SwDrawContact::ChkPage()
     }
 
     // --> #i28701#
+    // tdf#156287: use anchor page, not current bound rectangle's page,
+    // because an object can't move to a page other than its anchor anyway
     SwPageFrame* pPg = ( maAnchoredDrawObj.GetAnchorFrame() &&
                        maAnchoredDrawObj.GetAnchorFrame()->IsPageFrame() )
                      ? GetPageFrame()
-                     : FindPage( SwRect(GetMaster()->GetCurrentBoundRect()) );
+                     : maAnchoredDrawObj.FindPageFrameOfAnchor();
     if ( GetPageFrame() == pPg )
         return;
 

Reply via email to