If a filter was added to a handler which belonged to a looper, the filter's looper was never initialized. BHandler::SetLooper() now also sets the looper for every filter (moved from BLooper::AddHandler)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13426 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2005-07-04 21:05:53 +00:00
parent 83291b44d0
commit 7089b0e3dc
2 changed files with 11 additions and 10 deletions

View File

@ -412,9 +412,12 @@ BHandler::AddFilter(BMessageFilter *filter)
}
#endif
if (fLooper != NULL)
filter->SetLooper(fLooper);
if (!fFilters)
fFilters = new BList;
fFilters->AddItem(filter);
}
@ -775,9 +778,14 @@ BHandler::operator=(const BHandler &)
void
BHandler::SetLooper(BLooper *loop)
BHandler::SetLooper(BLooper *looper)
{
fLooper = loop;
fLooper = looper;
if (fFilters) {
for (int32 i = 0; i < fFilters->CountItems(); i++)
static_cast<BMessageFilter *>(fFilters->ItemAtFast(i))->SetLooper(looper);
}
}

View File

@ -378,13 +378,6 @@ BLooper::AddHandler(BHandler* handler)
handler->SetLooper(this);
if (handler != this) // avoid a cycle
handler->SetNextHandler(this);
BList* filters = handler->FilterList();
if (filters) {
for (int32 i = 0; i < filters->CountItems(); ++i) {
((BMessageFilter*)filters->ItemAt(i))->SetLooper(this);
}
}
}
}