sw/source/core/text/txtfrm.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit b697ee5dc3c38806fc6f096364590e9e60256aeb
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Tue Feb 21 08:05:33 2023 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Feb 21 08:01:19 2023 +0000

    sw floattable: fix locking in SwTextFrame::Prepare()
    
    Once a floating table is split across 2 pages, we currently emit this
    warning:
    
    warn:legacy.osl:23427:23427:sw/source/core/text/txtfrm.cxx:2808: 
SwTextFrame::Prepare: three of a perfect pair
    
    Which suggests that we want to invalidate the size of a frame that is
    already locked.
    
    The way normal frame split doesn't hit this warning is that the master
    has some content, then once SwContentFrame::Paste() on the follow calls
    SwTextFrame::Prepare() on the master, the !HasPara() condition is not
    hit, so it's not a problem that the frame is locked.
    
    Fix this for the split fly case by assuming that in case our offset and
    our follow's offset is both 0, then this frame will have some fly
    content, so don't return early (similar to what happens when the frame
    has some text content).
    
    We may want to revisit this later so that at least an SwParaPortion is
    generated for non-last anchors for split flys, but this is good enough
    for now, since the point is to not invalidate the size of a locked
    frame.
    
    Change-Id: I7c78472653bb6818f0d5880d21f468286be547e4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147378
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 5906c9c9d1f3..7ac2a5183114 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -2823,7 +2823,12 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, 
const void* pVoid,
         }
     }
 
-    if( !HasPara() && PrepareHint::MustFit != ePrep )
+    // Split fly anchors are technically empty (have no SwParaPortion), but 
otherwise behave like
+    // other split text frames, which are non-empty.
+    bool bSplitFlyAnchor = GetOffset() == TextFrameIndex(0) && HasFollow()
+                           && GetFollow()->GetOffset() == TextFrameIndex(0);
+
+    if( !HasPara() && !bSplitFlyAnchor && PrepareHint::MustFit != ePrep )
     {
         SetInvalidVert( true ); // Test
         OSL_ENSURE( !IsLocked(), "SwTextFrame::Prepare: three of a perfect 
pair" );

Reply via email to