[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/source

Michael Stahl mstahl at redhat.com
Fri Jan 5 19:25:52 UTC 2018


 sw/source/core/layout/trvlfrm.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit fdac745028c2616ca4c7d105471282fc431cabc5
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Dec 15 17:07:01 2017 +0100

    tdf#100635 sw: fix layout crash caused by field expansion ...
    
    ... triggering recursive layout-in-layout where a SwTextFrame
    that's being formatted is deleted inside some other frame's
    SwTextNode::GetFormatted().
    
    The offending field is a SwAuthorityField that's located in a
    fly-frame with FLY_AT_PAGE anchor.
    
    SwPageFrame::GetContentPosition() is only called by field expansion
    code, so this shouldn't have an effect on layout.
    
    It already has a fall-back for the case when the frame has invalid
    flags, so handle the situation when the SwLineLayout has been
    deleted from the SwCache due to overflow the same way,
    which prevents the recursive formatting.
    
    Change-Id: I90437edb5692dc2bdec7ad03964588942bde05be
    (cherry picked from commit b77881366b17230908f441dfa27afcafc4374708)
    Reviewed-on: https://gerrit.libreoffice.org/46569
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit a1e377aff16ea7c4d434ab60d7ed946c82514684)
    Reviewed-on: https://gerrit.libreoffice.org/46722
    Tested-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 05864d10a4ba..d854e092705c 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -1434,9 +1434,12 @@ void SwPageFrame::GetContentPosition( const Point &rPt, SwPosition &rPos ) const
     else if ( aAct.X() > aRect.Right() )
         aAct.X() = aRect.Right();
 
-    if( !pAct->IsValid() )
+    if (!pAct->IsValid() ||
+        (pAct->IsTextFrame() && !static_cast<SwTextFrame const*>(pAct)->HasPara()))
     {
         // ContentFrame not formatted -> always on node-beginning
+        // tdf#100635 also if the SwTextFrame would require reformatting,
+        // which is unwanted in case this is called from text formatting code
         SwContentNode* pCNd = const_cast<SwContentNode*>(pAct->GetNode());
         OSL_ENSURE( pCNd, "Where is my ContentNode?" );
         rPos.nNode = *pCNd;


More information about the Libreoffice-commits mailing list