* CID 532 and 533: calling erase on an iterator invalidates it.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38041 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-08-12 11:48:50 +00:00
parent cd8ca1e595
commit 9b957f41ab

View File

@ -104,8 +104,8 @@ status_t _ViewEntry::add(BView* pView, const tip_entry& tipEntry) {
// [e.moon 13oct99] ref'd by pointer
tip_entry_set::iterator itFound = viewEntry->m_tips.find(newTipEntry);
if(itFound != viewEntry->m_tips.end()) {
viewEntry->m_tips.erase(itFound);
delete *itFound;
viewEntry->m_tips.erase(itFound);
}
pair<tip_entry_set::iterator, bool> ret;
@ -163,10 +163,10 @@ status_t _ViewEntry::remove(
tip_entry matchEntry(rect);
tip_entry_set::iterator it = viewEntry->m_tips.lower_bound(&matchEntry);
tip_entry_set::iterator itEnd = viewEntry->m_tips.upper_bound(&matchEntry);
for(; it != itEnd; ++it) {
while(it != itEnd) {
// found one; erase it
delete *it;
viewEntry->m_tips.erase(it);
viewEntry->m_tips.erase(it++);
}
}
else {