The previous loop to remove all the BHandlers in the destructor was really quite

inefficient. And while it did check if the handler was not NULL, it would have
resulted in an endless loop if it was. I think we can safely assume we have no
NULL BHandlers in that list though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26870 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2008-08-07 21:42:02 +00:00
parent 39c564f1e7
commit f72ed717b4

View File

@ -153,12 +153,13 @@ BLooper::~BLooper()
RemoveHandler(this);
// Remove all the "child" handlers
BHandler* child;
while (CountHandlers()) {
child = HandlerAt(0);
if (child)
RemoveHandler(child);
int32 count = fHandlers.CountItems();
for (int32 i = 0; i < count; i++) {
BHandler* handler = (BHandler*)fHandlers.ItemAtFast(i);
handler->SetNextHandler(NULL);
handler->SetLooper(NULL);
}
fHandlers.MakeEmpty();
Unlock();
gLooperList.RemoveLooper(this);