UpdateIfNeeded() no longer keeps the looper's BMessageQueue locked when

calling DispatchMessage().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23870 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-02-05 08:36:01 +00:00
parent 753fd45fc2
commit 1ea104aeeb
+12 -14
View File
@@ -1698,27 +1698,25 @@ BWindow::UpdateIfNeeded()
_DequeueAll();
BMessageQueue *queue = MessageQueue();
queue->Lock();
// First process and remove any _UPDATE_ message in the queue
// With the current design, there can only be one at a time
BMessage *msg;
for (int32 i = 0; (msg = queue->FindMessage(i)) != NULL; i++) {
if (msg->what == _UPDATE_) {
BWindow::DispatchMessage(msg, this);
// we need to make sure that no overridden method is called
// here; for BWindow::DispatchMessage() we now exactly what
// will happen
queue->RemoveMessage(msg);
delete msg;
while (true) {
queue->Lock();
BMessage *message = queue->FindMessage(_UPDATE_, 0);
queue->RemoveMessage(message);
queue->Unlock();
if (message == NULL)
break;
// NOTE: "i" would have to be decreased if there were
// multiple _UPDATE_ messages and we would not break!
}
BWindow::DispatchMessage(message, this);
delete message;
}
queue->Unlock();
Unlock();
}