summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-04-19 23:30:13 +0200
committerMichael Stahl <mstahl@redhat.com>2012-04-20 12:57:49 +0200
commit33ee840e7b45eb971feef83215841edc0ba66cd7 (patch)
tree36480967cc2dfb3a5ab543c1460601f36c37ade7 /sw
parent69259c6509809c1064eb05690dcd9c19c840bae1 (diff)
fix STL conversion e94c4ab5523c7dcbee2f1b7fd47685529498e774 harder
looping vector iterators and push_back/erase don't mix well
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/layout/paintfrm.cxx22
1 files changed, 15 insertions, 7 deletions
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 03e973148e39..5ef023d4211f 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -643,9 +643,9 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut )
SvPtrarr aCheck( 64 );
- for (SwLineRects::iterator it = this->begin(); it != this->end(); ++it)
+ for (size_t i = 0; i < this->size(); )
{
- SwLineRect &rL1 = (*it);
+ SwLineRect &rL1 = (*this)[i];
if ( !rL1.GetTab() || rL1.IsPainted() || rL1.IsLocked() )
continue;
@@ -737,6 +737,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut )
rL1.GetTab(), SUBCOL_TAB ) );
if ( isFull() )
{
+ --i;
k = aCheck.Count();
break;
}
@@ -776,6 +777,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut )
rL1.GetTab(), SUBCOL_TAB ) );
if ( isFull() )
{
+ --i;
k = aCheck.Count();
break;
}
@@ -790,7 +792,11 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut )
}
if ( bRemove )
{
- this->erase( it );
+ this->erase(this->begin() + i);
+ }
+ else
+ {
+ ++i;
}
}
}
@@ -806,11 +812,11 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
{
// All help lines that are covered by any border will be removed or split
- for (SwSubsRects::iterator it = this->begin(); it != this->end(); ++it)
+ for (size_t i = 0; i < this->size(); ++i)
{
// get a copy instead of a reference, because an <insert> may destroy
// the object due to a necessary array resize.
- const SwLineRect aSubsLineRect = SwLineRect(*it);
+ const SwLineRect aSubsLineRect = SwLineRect((*this)[i]);
// add condition <aSubsLineRect.IsLocked()> in order to consider only
// border lines, which are *not* locked.
@@ -865,7 +871,8 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
this->push_back( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0,
aSubsLineRect.GetSubColor() ) );
}
- this->erase(it);
+ this->erase(this->begin() + i);
+ --i;
break;
}
}
@@ -890,7 +897,8 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
this->push_back( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0,
aSubsLineRect.GetSubColor() ) );
}
- this->erase(it);
+ this->erase(this->begin() + i);
+ --i;
break;
}
}