* Don't trust a message that we got goes to a handler that belongs to us.
* when we terminate gracefully and in the looper's thread, we no longer unlock ourselves. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15155 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1250,6 +1250,10 @@ BLooper::task_looper()
|
|||||||
gDefaultTokens.GetToken(messagePrivate.GetTarget(),
|
gDefaultTokens.GetToken(messagePrivate.GetTarget(),
|
||||||
B_HANDLER_TOKEN, (void **)&handler);
|
B_HANDLER_TOKEN, (void **)&handler);
|
||||||
|
|
||||||
|
// if this handler doesn't belong to us, we drop the message
|
||||||
|
if (handler != NULL && handler->Looper() != this)
|
||||||
|
handler = NULL;
|
||||||
|
|
||||||
PRINT(("LOOPER: use %ld, handler: %p, this: %p\n",
|
PRINT(("LOOPER: use %ld, handler: %p, this: %p\n",
|
||||||
messagePrivate.GetTarget(), handler, this));
|
messagePrivate.GetTarget(), handler, this));
|
||||||
}
|
}
|
||||||
@@ -1271,6 +1275,11 @@ BLooper::task_looper()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fTerminating) {
|
||||||
|
// we leave the looper locked when we quit
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Unlock the looper
|
// Unlock the looper
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
|
|||||||
@@ -2248,6 +2248,10 @@ BWindow::task_looper()
|
|||||||
} else {
|
} else {
|
||||||
gDefaultTokens.GetToken(messagePrivate.GetTarget(),
|
gDefaultTokens.GetToken(messagePrivate.GetTarget(),
|
||||||
B_HANDLER_TOKEN, (void **)&handler);
|
B_HANDLER_TOKEN, (void **)&handler);
|
||||||
|
|
||||||
|
// if this handler doesn't belong to us, we drop the message
|
||||||
|
if (handler != NULL && handler->Looper() != this)
|
||||||
|
handler = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handler == NULL || usePreferred)
|
if (handler == NULL || usePreferred)
|
||||||
@@ -2280,6 +2284,11 @@ BWindow::task_looper()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fTerminating) {
|
||||||
|
// we leave the looper locked when we quit
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
// Are any messages on the port?
|
// Are any messages on the port?
|
||||||
|
|||||||
Reference in New Issue
Block a user