From 9b957f41ab94b0223c8e971ea782a0fbb9eace81 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Thu, 12 Aug 2010 11:48:50 +0000 Subject: [PATCH] * 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 --- src/apps/cortex/TipManager/TipManagerImpl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/apps/cortex/TipManager/TipManagerImpl.cpp b/src/apps/cortex/TipManager/TipManagerImpl.cpp index c3f78615a2..44f4c25c0e 100644 --- a/src/apps/cortex/TipManager/TipManagerImpl.cpp +++ b/src/apps/cortex/TipManager/TipManagerImpl.cpp @@ -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 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 {