* fix a nasty bug i introduced with 26383, leaving the looper locked
* grab the fLooper pointer in some more functions, just to play save * remove wrong comment in UnlockLooper, since it's obviously possible to change fLooper In case we remove the handler from the loopers handler list, we need to grab the looper pointer first, since calling RemoveHandler(...) will call BHandler::SetLooper(...) thus setting fLooper to NULL and calling UnlockLooper did nothing, leaving the looper locked. Thanks Maurice for pointing out that 26383 broke Cortex, the wires where not draw and the app was locked somehow. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27872 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
17e0fc6b5a
commit
2617261d77
@ -132,8 +132,9 @@ BHandler::BHandler(const char *name)
|
||||
BHandler::~BHandler()
|
||||
{
|
||||
if (LockLooper()) {
|
||||
Looper()->RemoveHandler(this);
|
||||
UnlockLooper();
|
||||
BLooper* looper = Looper();
|
||||
looper->RemoveHandler(this);
|
||||
looper->Unlock();
|
||||
}
|
||||
|
||||
// remove all filters
|
||||
@ -331,13 +332,14 @@ BHandler::NextHandler() const
|
||||
void
|
||||
BHandler::AddFilter(BMessageFilter *filter)
|
||||
{
|
||||
if (fLooper && !fLooper->IsLocked()) {
|
||||
BLooper* looper = fLooper;
|
||||
if (looper && !looper->IsLocked()) {
|
||||
debugger("Owning Looper must be locked before calling SetFilterList");
|
||||
return;
|
||||
}
|
||||
|
||||
if (fLooper != NULL)
|
||||
filter->SetLooper(fLooper);
|
||||
if (looper != NULL)
|
||||
filter->SetLooper(looper);
|
||||
|
||||
if (!fFilters)
|
||||
fFilters = new BList;
|
||||
@ -349,7 +351,8 @@ BHandler::AddFilter(BMessageFilter *filter)
|
||||
bool
|
||||
BHandler::RemoveFilter(BMessageFilter *filter)
|
||||
{
|
||||
if (fLooper && !fLooper->IsLocked()) {
|
||||
BLooper* looper = fLooper;
|
||||
if (looper && !looper->IsLocked()) {
|
||||
debugger("Owning Looper must be locked before calling SetFilterList");
|
||||
return false;
|
||||
}
|
||||
@ -366,7 +369,8 @@ BHandler::RemoveFilter(BMessageFilter *filter)
|
||||
void
|
||||
BHandler::SetFilterList(BList* filters)
|
||||
{
|
||||
if (fLooper && !fLooper->IsLocked()) {
|
||||
BLooper* looper = fLooper;
|
||||
if (looper && !looper->IsLocked()) {
|
||||
debugger("Owning Looper must be locked before calling SetFilterList");
|
||||
return;
|
||||
}
|
||||
@ -391,7 +395,7 @@ BHandler::SetFilterList(BList* filters)
|
||||
BMessageFilter *filter =
|
||||
static_cast<BMessageFilter *>(fFilters->ItemAt(i));
|
||||
if (filter != NULL)
|
||||
filter->SetLooper(fLooper);
|
||||
filter->SetLooper(looper);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -447,9 +451,7 @@ BHandler::LockLooperWithTimeout(bigtime_t timeout)
|
||||
void
|
||||
BHandler::UnlockLooper()
|
||||
{
|
||||
// The looper is locked at this point, and cannot change
|
||||
if (fLooper != NULL)
|
||||
fLooper->Unlock();
|
||||
fLooper->Unlock();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user