[Libreoffice-commits] core.git: 2 commits - sw/source

Michael Stahl mstahl at redhat.com
Thu Sep 7 09:13:19 UTC 2017


 sw/source/core/text/frmform.cxx  |   15 +++++++++++----
 sw/source/core/text/itrtxt.cxx   |    2 +-
 sw/source/core/text/redlnitr.cxx |    2 +-
 3 files changed, 13 insertions(+), 6 deletions(-)

New commits:
commit 6c8c51231e7415ecc20d1343211acf8382666613
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Sep 6 23:18:23 2017 +0200

    tdf#112163 sw: avoid crashing in layout on this document
    
    SwTextFrame 0x5dfb7a0 is join locked so doesn't GetFormatted() so
    doesn't have a SwTextLineAccess created; add some defensive programming
    just to make it not crash.
    
    Whether this is the right fix or just a workaround for something going
    wrong in the 179 layout stack frames is beyond my meager knowledge.
    
    In case anybody has an obvious idea, the layout frames that are
    currently being formatted (SwTextFrame or SwTabFrame) are:
    
     #3 0x5dfb7a0 is master of 0x5e56330
    
     #4 0x5e56330
    
     #10 0x5e5f3f0 is follow of 0x5e56330
    
     #19 0x5e60d30 SwTabFrame::Split
    
     #30 0x5e56330
    
     #44 0x5dfb7a0
    
     #53 0x2cefae0 master of 0x5dfb7a0
    
     #57 0x63d1440 SwTabFrame::MakeAll is follow of #58
    
     #58 0x5e106c0 SwTabFrame::MakeAll
    
     #68 0x5e812d0
    
     #77 0x5e11f80 is master of #68
    
     #86 0x2cef600 is master of #77
    
     #90 0x5f86c00 SwTabFrame::MakeAll
    
     #91 0x63d0150 SwTabFrame::MakeAll
    
     #98 SwFlowFrame::MoveFwd
     #101 0x63cf3d0
    
     #110 0x5e05ff0 is master of #101
    
     #119 0x5e0c700 is master of #110
    
     #128 0x5bd0ad0 is master of #119
    
     #136 0x5f8b800 is master of #128
    
     #145 0x86b29a0 is master of #136
    
     #154 0x2c37340 is master of #145
    
     #158 0x5e04ab0 SwTabFrame::MakeAll
    
     #168 0x2c371a0
    
     #173 0x5e16340 SwTabFrame::MakeAll
    
    Change-Id: I716b5faec1512cbf1fbdb04a436da302bd628c51

diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 7cd5e09eea71..4064466227dc 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -1399,10 +1399,17 @@ void SwTextFrame::Format_( SwTextFormatter &rLine, SwTextFormatInfo &rInf,
         {
             if( !pMaster->HasPara() )
                 pMaster->GetFormatted();
-            SwTextSizeInfo aInf( pMaster );
-            SwTextIter aMasterLine( pMaster, &aInf );
-            aMasterLine.Bottom();
-            pLine = aMasterLine.GetCurr();
+            if (!pMaster->HasPara())
+            {   // master could be locked because it's being formatted upstack
+                SAL_WARN("sw", "SwTextFrame::Format_: failed to format master!");
+            }
+            else
+            {
+                SwTextSizeInfo aInf( pMaster );
+                SwTextIter aMasterLine( pMaster, &aInf );
+                aMasterLine.Bottom();
+                pLine = aMasterLine.GetCurr();
+            }
         }
         SwLinePortion* pRest = pLine ?
             rLine.MakeRestPortion(pLine, GetOfst()) : nullptr;
commit 2077a2f15ebeaebcce903c44d4ee21501b3cbfaf
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Sep 6 23:18:10 2017 +0200

    sw: these should be asserts
    
    Change-Id: I364c5005f999102481a0ae2add7f7b9781870d00

diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx
index 948a5682648f..8a09ded09c92 100644
--- a/sw/source/core/text/itrtxt.cxx
+++ b/sw/source/core/text/itrtxt.cxx
@@ -37,7 +37,7 @@ void SwTextIter::CtorInitTextIter( SwTextFrame *pNewFrame, SwTextInfo *pNewInf )
 {
     SwTextNode *pNode = pNewFrame->GetTextNode();
 
-    OSL_ENSURE( pNewFrame->GetPara(), "No paragraph" );
+    assert(pNewFrame->GetPara());
 
     CtorInitAttrIter( *pNode, pNewFrame->GetPara()->GetScriptInfo(), pNewFrame );
 
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index aede807d9520..a7d8427e81c4 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -86,7 +86,7 @@ void SwAttrIter::CtorInitAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf,
     m_aMagicNo[SwFontScript::Latin] = m_aMagicNo[SwFontScript::CJK] = m_aMagicNo[SwFontScript::CTL] = nullptr;
 
     // determine script changes if not already done for current paragraph
-    OSL_ENSURE( m_pScriptInfo, "No script info available");
+    assert(m_pScriptInfo);
     if ( m_pScriptInfo->GetInvalidityA() != COMPLETE_STRING )
          m_pScriptInfo->InitScriptInfo( rTextNode, bRTL );
 


More information about the Libreoffice-commits mailing list