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(); _DequeueAll();
BMessageQueue *queue = MessageQueue(); BMessageQueue *queue = MessageQueue();
queue->Lock();
// First process and remove any _UPDATE_ message in the queue // First process and remove any _UPDATE_ message in the queue
// With the current design, there can only be one at a time // With the current design, there can only be one at a time
BMessage *msg; while (true) {
for (int32 i = 0; (msg = queue->FindMessage(i)) != NULL; i++) { queue->Lock();
if (msg->what == _UPDATE_) {
BWindow::DispatchMessage(msg, this); BMessage *message = queue->FindMessage(_UPDATE_, 0);
// we need to make sure that no overridden method is called queue->RemoveMessage(message);
// here; for BWindow::DispatchMessage() we now exactly what
// will happen queue->Unlock();
queue->RemoveMessage(msg);
delete msg; if (message == NULL)
break; 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(); Unlock();
} }