sw/source/core/layout/frmtool.cxx |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

New commits:
commit 5141f2e0d89a8a10f0009bea40cc5cd15bf4fcc8
Author: Caolán McNamara <caol...@redhat.com>
Date:   Wed Dec 10 09:38:35 2014 +0000

    Resolves: fdo#53460 crashes after casting SwTxtFrm to unrelated SwLayoutFrm
    
    We still can't use ctrl+up to shrink the height of a row that has a table in
    it, but it doesn't crash anymore.
    
    This code presumably isn't truly table-in-table aware and should somehow 
step
    "over" the embedded table and not "into" it, which is what I guess it is 
doing
    here.
    
    Change-Id: I0e4c757c75438a89eb7721de32990f2f21c1ad8b

diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index 6173a03..6a9c619 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -3193,12 +3193,11 @@ static SwTwips lcl_CalcCellRstHeight( SwLayoutFrm 
*pCell )
     {
         long nRstHeight = 0;
         SwFrm *pLow = pCell->Lower();
-        do
-        {   nRstHeight += ::CalcRowRstHeight( static_cast<SwLayoutFrm*>(pLow) 
);
+        while (pLow && pLow->IsLayoutFrm())
+        {
+            nRstHeight += ::CalcRowRstHeight(static_cast<SwLayoutFrm*>(pLow));
             pLow = pLow->GetNext();
-
-        } while ( pLow );
-
+        }
         return nRstHeight;
     }
 }
@@ -3206,11 +3205,11 @@ static SwTwips lcl_CalcCellRstHeight( SwLayoutFrm 
*pCell )
 SwTwips CalcRowRstHeight( SwLayoutFrm *pRow )
 {
     SwTwips nRstHeight = LONG_MAX;
-    SwLayoutFrm *pLow = static_cast<SwLayoutFrm*>(pRow->Lower());
-    while ( pLow )
+    SwFrm *pLow = pRow->Lower();
+    while (pLow && pLow->IsLayoutFrm())
     {
-        nRstHeight = std::min( nRstHeight, ::lcl_CalcCellRstHeight( pLow ) );
-        pLow = static_cast<SwLayoutFrm*>(pLow->GetNext());
+        nRstHeight = std::min(nRstHeight, 
::lcl_CalcCellRstHeight(static_cast<SwLayoutFrm*>(pLow)));
+        pLow = pLow->GetNext();
     }
     return nRstHeight;
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to