[Libreoffice-commits] core.git: sw/source
Michael Stahl
mstahl at redhat.com
Wed Apr 22 06:11:03 PDT 2015
sw/source/core/doc/docredln.cxx | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
New commits:
commit 28764d7ed5df874c2bfbc6025a97968e08cf2315
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Apr 22 14:28:38 2015 +0200
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
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 4488e49..20db662 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 )
More information about the Libreoffice-commits
mailing list