diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-12-10 09:38:35 +0000 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-12-13 16:01:16 +0100 |
commit | 8137d215606d8334344b5f11a1c03e65635a73c5 (patch) | |
tree | 30a69ee4e4f01a33e29e1786005fffa28c324cc6 /sw | |
parent | 047c9e56ab9e790d4c6c00e3f29410b3d8c343ba (diff) |
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.
(cherry picked from commit 5141f2e0d89a8a10f0009bea40cc5cd15bf4fcc8)
Conflicts:
sw/source/core/layout/frmtool.cxx
Change-Id: I0e4c757c75438a89eb7721de32990f2f21c1ad8b
(cherry picked from commit c1a5e49bdb0d6c1533d33520ea7c01a660a5d1f4)
Reviewed-on: https://gerrit.libreoffice.org/13412
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/layout/frmtool.cxx | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 3418f3d9dad6..d7f6588e496c 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -3129,12 +3129,11 @@ static SwTwips lcl_CalcCellRstHeight( SwLayoutFrm *pCell ) { long nRstHeight = 0; SwFrm *pLow = pCell->Lower(); - do - { nRstHeight += ::CalcRowRstHeight( (SwLayoutFrm*)pLow ); + while (pLow && pLow->IsLayoutFrm()) + { + nRstHeight += ::CalcRowRstHeight(static_cast<SwLayoutFrm*>(pLow)); pLow = pLow->GetNext(); - - } while ( pLow ); - + } return nRstHeight; } } @@ -3142,11 +3141,11 @@ static SwTwips lcl_CalcCellRstHeight( SwLayoutFrm *pCell ) SwTwips CalcRowRstHeight( SwLayoutFrm *pRow ) { SwTwips nRstHeight = LONG_MAX; - SwLayoutFrm *pLow = (SwLayoutFrm*)pRow->Lower(); - while ( pLow ) + SwFrm *pLow = pRow->Lower(); + while (pLow && pLow->IsLayoutFrm()) { - nRstHeight = std::min( nRstHeight, ::lcl_CalcCellRstHeight( pLow ) ); - pLow = (SwLayoutFrm*)pLow->GetNext(); + nRstHeight = std::min(nRstHeight, ::lcl_CalcCellRstHeight(static_cast<SwLayoutFrm*>(pLow))); + pLow = pLow->GetNext(); } return nRstHeight; } |