diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-04-22 14:28:38 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-04-22 15:01:12 +0200 |
commit | 28764d7ed5df874c2bfbc6025a97968e08cf2315 (patch) | |
tree | 83d79f23d7afb457b7622db20861ad8b57f9ff31 /sw | |
parent | 407733158220ada48ff66768f218bbc9bdb51098 (diff) |
rhbz#1198848: sw: delete *all* table redlines to fix DOCX import crash
SwExtraRedlineTbl::DeleteAllTableRedlines() increments its position even
when deleting the current element from the vector.
Change-Id: Ie827a7b66fa9690bbabaf53204e9ec77247239f2
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/docredln.cxx | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 4488e4944a4b..20db6623ddd9 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -139,7 +139,7 @@ bool SwExtraRedlineTbl::DeleteAllTableRedlines( SwDoc* pDoc, const SwTable& rTab */ } - for(sal_uInt16 nCurRedlinePos = 0; nCurRedlinePos < GetSize(); ++nCurRedlinePos ) + for (sal_uInt16 nCurRedlinePos = 0; nCurRedlinePos < GetSize(); ) { SwExtraRedline* pExtraRedline = GetRedline(nCurRedlinePos); const SwTableCellRedline* pTableCellRedline = dynamic_cast<const SwTableCellRedline*>(pExtraRedline); @@ -154,11 +154,13 @@ bool SwExtraRedlineTbl::DeleteAllTableRedlines( SwDoc* pDoc, const SwTable& rTab const RedlineType_t nRedlineType = aRedlineData.GetType(); // Check if this redline object type should be deleted - if( USHRT_MAX != nRedlineTypeToDelete && nRedlineTypeToDelete != nRedlineType ) - continue; + if (USHRT_MAX == nRedlineTypeToDelete || nRedlineTypeToDelete == nRedlineType) + { - DeleteAndDestroy( nCurRedlinePos ); - bChg = true; + DeleteAndDestroy( nCurRedlinePos ); + bChg = true; + continue; // don't increment position after delete + } } } else @@ -176,14 +178,17 @@ bool SwExtraRedlineTbl::DeleteAllTableRedlines( SwDoc* pDoc, const SwTable& rTab const RedlineType_t nRedlineType = aRedlineData.GetType(); // Check if this redline object type should be deleted - if( USHRT_MAX != nRedlineTypeToDelete && nRedlineTypeToDelete != nRedlineType ) - continue; + if (USHRT_MAX == nRedlineTypeToDelete || nRedlineTypeToDelete == nRedlineType) - DeleteAndDestroy( nCurRedlinePos ); - bChg = true; + { + DeleteAndDestroy( nCurRedlinePos ); + bChg = true; + continue; // don't increment position after delete + } } } } + ++nCurRedlinePos; } if( bChg ) |