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

Manfred Blume manfred.blume at cib.de
Tue Feb 6 16:10:14 UTC 2018


 sw/source/core/layout/tabfrm.cxx |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

New commits:
commit d30eefb677b446886f7b5bab6de93d489ba63529
Author: Manfred Blume <manfred.blume at cib.de>
Date:   Wed Jan 31 16:37:55 2018 +0100

    tdf#114306 fix crash caused by special document 2
    
    Regression from 18765b9fa739337d2d891513f6e2fb7c3ce23b50
    
    Change-Id: Ic4205777077e4e3d93bdddf743c51abba8950eaf
    Reviewed-on: https://gerrit.libreoffice.org/49031
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
old mode 100644
new mode 100755
index d0f2ddddba26..b816dfdf319e
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -163,7 +163,7 @@ void SwTabFrame::RegistFlys()
 }
 
 void SwInvalidateAll( SwFrame *pFrame, long nBottom );
-static void lcl_RecalcRow( SwRowFrame* pRow, long nBottom );
+static bool lcl_RecalcRow( SwRowFrame* pRow, long nBottom );
 static bool lcl_ArrangeLowers( SwLayoutFrame *pLay, long lYStart, bool bInva );
 // #i26945# - add parameter <_bOnlyRowsAndCells> to control
 // that only row and cell frames are formatted.
@@ -1555,7 +1555,8 @@ static bool lcl_InnerCalcLayout( SwFrame *pFrame,
     return bRet;
 }
 
-static void lcl_RecalcRow( SwRowFrame* pRow, long nBottom )
+// returns false if pRow is invalid
+static bool lcl_RecalcRow( SwRowFrame* pRow, long nBottom )
 {
     // FME 2007-08-30 #i81146# new loop control
     int nLoopControlRuns_1 = 0;
@@ -1613,7 +1614,7 @@ static void lcl_RecalcRow( SwRowFrame* pRow, long nBottom )
             if (!bRowStillExists)
             {
                 SAL_WARN("sw.layout", "no row anymore at " << pRow);
-                return;
+                return false;
             }
 
             // NEW TABLES
@@ -1657,7 +1658,8 @@ static void lcl_RecalcRow( SwRowFrame* pRow, long nBottom )
             }
         }
         break;
-    } while( true );
+    } while (true);
+    return true;
 }
 
 static void lcl_RecalcTable( SwTabFrame& rTab,
@@ -2344,7 +2346,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
 
             // 1. Try: bTryToSplit = true  => Try to split the row.
             // 2. Try: bTryToSplit = false => Split the table between the rows.
-            if ( pFirstNonHeadlineRow->GetNext() || bTryToSplit )
+            if ((pFirstNonHeadlineRow && pFirstNonHeadlineRow->GetNext()) || bTryToSplit )
             {
                 SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*GetUpper());
                 if( IsInSct() || GetUpper()->IsInTab() ) // TABLE IN TABLE)
@@ -2353,7 +2355,11 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
 
                 {
                     SetInRecalcLowerRow( true );
-                    ::lcl_RecalcRow( static_cast<SwRowFrame*>(Lower()), nDeadLine );
+                    SwRowFrame* pRow = static_cast<SwRowFrame*>(Lower());
+                    if (!lcl_RecalcRow(pRow, nDeadLine))
+                    {
+                        pFirstNonHeadlineRow = GetFirstNonHeadlineRow();
+                    }
                     SetInRecalcLowerRow( false );
                 }
                 m_bLowersFormatted = true;


More information about the Libreoffice-commits mailing list