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

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 2 08:54:15 UTC 2019


 sw/source/core/layout/tabfrm.cxx |   56 ++++++++++-----------------------------
 1 file changed, 15 insertions(+), 41 deletions(-)

New commits:
commit a73f537efe225cef1eb0290ad71fad675038273f
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Jul 1 14:28:31 2019 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Jul 2 10:53:21 2019 +0200

    sw: remove hacky liveness check in lcl_RecalcRow()
    
    Crashtesting didn't find any assert there so now revert most of commit
    e4400f4c4e267f8528df3a7d5a09623c888bd10c.
    
    Change-Id: I6e990b76af0d047b50115cb019a352f1a04a65ed
    Reviewed-on: https://gerrit.libreoffice.org/74954
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 0937a8920023..21607647593b 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -170,7 +170,7 @@ void SwTabFrame::RegistFlys()
 }
 
 static void SwInvalidateAll( SwFrame *pFrame, long nBottom );
-static void lcl_RecalcRow( SwRowFrame* pRow, long nBottom );
+static void lcl_RecalcRow( SwRowFrame& rRow, 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.
@@ -688,7 +688,7 @@ static bool lcl_RecalcSplitLine( SwRowFrame& rLastLine, SwRowFrame& rFollowLine,
     rLastLine.SetInSplit();
 
     // Do the recalculation
-    lcl_RecalcRow( &rLastLine, LONG_MAX );
+    lcl_RecalcRow( rLastLine, LONG_MAX );
     // #115759# - force a format of the last line in order to
     // get the correct height.
     rLastLine.InvalidateSize();
@@ -1605,7 +1605,7 @@ static bool lcl_InnerCalcLayout( SwFrame *pFrame,
     return bRet;
 }
 
-static void lcl_RecalcRow(SwRowFrame *const pRow, long const nBottom)
+static void lcl_RecalcRow(SwRowFrame & rRow, long const nBottom)
 {
     // FME 2007-08-30 #i81146# new loop control
     int nLoopControlRuns_1 = 0;
@@ -1619,14 +1619,14 @@ static void lcl_RecalcRow(SwRowFrame *const pRow, long const nBottom)
         int nLoopControlRuns_2 = 0;
         sal_uInt16 nLoopControlStage_2 = 0;
 
-        while( lcl_InnerCalcLayout( pRow, nBottom ) )
+        while (lcl_InnerCalcLayout(&rRow, nBottom))
         {
             if ( ++nLoopControlRuns_2 > nLoopControlMax )
             {
                 SAL_WARN_IF(nLoopControlStage_2 == 0, "sw.layout", "LoopControl_2 in lcl_RecalcRow: Stage 1!");
                 SAL_WARN_IF(nLoopControlStage_2 == 1, "sw.layout", "LoopControl_2 in lcl_RecalcRow: Stage 2!!");
                 SAL_WARN_IF(nLoopControlStage_2 >= 2, "sw.layout", "LoopControl_2 in lcl_RecalcRow: Stage 3!!!");
-                pRow->ValidateThisAndAllLowers( nLoopControlStage_2++ );
+                rRow.ValidateThisAndAllLowers( nLoopControlStage_2++ );
                 nLoopControlRuns_2 = 0;
                 if( nLoopControlStage_2 > 2 )
                     break;
@@ -1639,40 +1639,14 @@ static void lcl_RecalcRow(SwRowFrame *const pRow, long const nBottom)
         {
             // #115759# - force another format of the
             // lowers, if at least one of it was invalid.
-
-            // tdf#114306 writer may crash because pRow points to a deleted SwRowFrame
-            SwRowFrame* pOriginalRow = pRow;
-            OSL_ENSURE(pOriginalRow->GetUpper() && pOriginalRow->GetUpper()->IsTabFrame(), "No table");
-            SwTabFrame* pOriginalTab = static_cast<SwTabFrame*>(pRow->GetUpper());
-
-            bCheck = SwContentFrame::CalcLowers(*pRow, *pRow->GetUpper(), nBottom, true);
-
-            bool bRowStillExists = false;
-            SwFrame* pTestRow = pOriginalTab->Lower();
-
-            while (pTestRow)
-            {
-                if (pTestRow == pRow)
-                {
-                    bRowStillExists = true;
-                    break;
-                }
-                pTestRow = pTestRow->GetNext();
-            }
-
-            if (!bRowStillExists)
-            {
-                SAL_WARN("sw.layout", "no row anymore at " << pRow);
-                assert(!"this should no longer happen after 1e6dec4b4313212a3bdc6bb06155fd65e795368b");
-                return;
-            }
+            bCheck = SwContentFrame::CalcLowers(rRow, *rRow.GetUpper(), nBottom, true);
 
             // NEW TABLES
             // First we calculate the cells with row span of < 1, afterwards
             // all cells with row span of > 1:
             for ( int i = 0; i < 2; ++i )
             {
-                SwCellFrame* pCellFrame = static_cast<SwCellFrame*>(pRow->Lower());
+                SwCellFrame* pCellFrame = static_cast<SwCellFrame*>(rRow.Lower());
                 while ( pCellFrame )
                 {
                     const bool bCalc = 0 == i ?
@@ -1698,7 +1672,7 @@ static void lcl_RecalcRow(SwRowFrame *const pRow, long const nBottom)
                     SAL_WARN_IF(nLoopControlStage_1 == 0, "sw.layout", "LoopControl_1 in lcl_RecalcRow: Stage 1!");
                     SAL_WARN_IF(nLoopControlStage_1 == 1, "sw.layout", "LoopControl_1 in lcl_RecalcRow: Stage 2!!");
                     SAL_WARN_IF(nLoopControlStage_1 >= 2, "sw.layout", "LoopControl_1 in lcl_RecalcRow: Stage 3!!!");
-                    pRow->ValidateThisAndAllLowers( nLoopControlStage_1++ );
+                    rRow.ValidateThisAndAllLowers( nLoopControlStage_1++ );
                     nLoopControlRuns_1 = 0;
                     if( nLoopControlStage_1 > 2 )
                         break;
@@ -1723,7 +1697,7 @@ static void lcl_RecalcTable( SwTabFrame& rTab,
             rNotify.SetLowersComplete( true );
         }
         ::SwInvalidatePositions( pFirstRow, LONG_MAX );
-        lcl_RecalcRow( static_cast<SwRowFrame*>(pFirstRow), LONG_MAX );
+        lcl_RecalcRow( *static_cast<SwRowFrame*>(pFirstRow), LONG_MAX );
     }
 }
 
@@ -2193,7 +2167,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
                             {
                                 ::SwInvalidateAll( pLastLine, LONG_MAX );
                                 SetRebuildLastLine( true );
-                                lcl_RecalcRow( static_cast<SwRowFrame*>(pLastLine), LONG_MAX );
+                                lcl_RecalcRow(*static_cast<SwRowFrame*>(pLastLine), LONG_MAX);
                                 SetRebuildLastLine( false );
                             }
 
@@ -2319,7 +2293,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
                 }
                 else if (m_bONECalcLowers)
                 {
-                    lcl_RecalcRow( static_cast<SwRowFrame*>(Lower()), LONG_MAX );
+                    lcl_RecalcRow(*static_cast<SwRowFrame*>(Lower()), LONG_MAX);
                     m_bONECalcLowers = false;
                 }
             }
@@ -2342,7 +2316,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
             }
             else if (m_bONECalcLowers)
             {
-                lcl_RecalcRow( static_cast<SwRowFrame*>(Lower()), LONG_MAX );
+                lcl_RecalcRow(*static_cast<SwRowFrame*>(Lower()), LONG_MAX);
                 m_bONECalcLowers = false;
             }
 
@@ -2408,7 +2382,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
 
                 {
                     SetInRecalcLowerRow( true );
-                    ::lcl_RecalcRow( static_cast<SwRowFrame*>(Lower()), nDeadLine );
+                    ::lcl_RecalcRow(*static_cast<SwRowFrame*>(Lower()), nDeadLine);
                     SetInRecalcLowerRow( false );
                 }
                 m_bLowersFormatted = true;
@@ -2505,7 +2479,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
                     // to nDeadLine may not be enough.
                     if ( bSplitError && bTryToSplit ) // no restart if we did not try to split: i72847, i79426
                     {
-                        lcl_RecalcRow( static_cast<SwRowFrame*>(Lower()), LONG_MAX );
+                        lcl_RecalcRow(*static_cast<SwRowFrame*>(Lower()), LONG_MAX);
                         setFrameAreaPositionValid(false);
                         bTryToSplit = false;
                         continue;
@@ -2546,7 +2520,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
                             // its content.
                             const bool bOldJoinLock =  GetFollow()->IsJoinLocked();
                             GetFollow()->LockJoin();
-                            ::lcl_RecalcRow( static_cast<SwRowFrame*>(GetFollow()->Lower()),
+                            ::lcl_RecalcRow(*static_cast<SwRowFrame*>(GetFollow()->Lower()),
                                              fnRectX.GetBottom(GetFollow()->GetUpper()->getFrameArea()) );
                             // #i43913#
                             // #i63632# Do not unlock the


More information about the Libreoffice-commits mailing list