From 2f03d0e0ed4eab02e388c6c2806be8d8e3faa88d Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Tue, 5 Jun 2007 13:15:45 +0000 Subject: [PATCH] Changed the loops in BHandler::_SendNotices() and ::_ValidateHandlers(). See also r20183. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21331 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/Handler.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/kits/app/Handler.cpp b/src/kits/app/Handler.cpp index 9da37c39dc..a5947b1b69 100644 --- a/src/kits/app/Handler.cpp +++ b/src/kits/app/Handler.cpp @@ -682,14 +682,15 @@ ObserverList::_ValidateHandlers(uint32 what) vector& handlers = fHandlerMap[what]; vector::iterator iterator = handlers.begin(); - for (; iterator != handlers.end(); iterator++) { + while (iterator != handlers.end()) { BMessenger target(*iterator); - if (!target.IsValid()) + if (!target.IsValid()) { + iterator++; continue; + } - handlers.erase(iterator); - iterator--; Add(target, what); + handlers.erase(iterator); } } @@ -704,13 +705,14 @@ ObserverList::_SendNotices(uint32 what, BMessage* message) vector& messengers = fMessengerMap[what]; vector::iterator iterator = messengers.begin(); - for (; iterator != messengers.end(); iterator++) { + while (iterator != messengers.end()) { if (!(*iterator).IsValid()) { messengers.erase(iterator); continue; } (*iterator).SendMessage(message); + iterator++; } }