mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
CEventLoop: Don't re-process already processed events when un-nesting.
If we had already processed a couple of queued events by the time we were told to un-nest the event loop, we'd put the entire current batch at the head of the outer queue. This meant that we might end up trying to process the same events multiple times. Let's not do that. :^)
This commit is contained in:
parent
3363426a6b
commit
d21a4f7518
Notes:
sideshowbarker
2024-07-19 13:03:21 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d21a4f7518c
1 changed files with 6 additions and 2 deletions
|
@ -141,8 +141,12 @@ void CEventLoop::pump(WaitMode mode)
|
|||
|
||||
if (m_exit_requested) {
|
||||
LOCKER(m_lock);
|
||||
// FIXME: Shouldn't we only prepend the events that haven't been processed yet?
|
||||
m_queued_events.prepend(move(events));
|
||||
decltype(m_queued_events) new_event_queue;
|
||||
new_event_queue.ensure_capacity(m_queued_events.size() + events.size());
|
||||
for (; i < events.size(); ++i)
|
||||
new_event_queue.unchecked_append(move(events[i]));
|
||||
new_event_queue.append(move(m_queued_events));
|
||||
m_queued_events = move(new_event_queue);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue