summaryrefslogtreecommitdiff
path: root/Libraries/LibCore
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-04-03 22:55:48 +0200
committerAndreas Kling <kling@serenityos.org>2020-04-03 22:55:48 +0200
commiteeec1c1293705945f6b03fc5f33693e3c8fdc02a (patch)
tree5d0f06aaf5283a179f2bcf914d59d369b5c83269 /Libraries/LibCore
parent9eec63e471b5f7302ad256e9cbabe27ad6257c9c (diff)
downloadserenity-eeec1c1293705945f6b03fc5f33693e3c8fdc02a.zip
LibCore: Don't replay last handled event when leaving nested event loop
The event that triggered the exit from an inner event loop would always get re-delivered in the outer event loop due to a silly off-by-one mistake when transferring pending events between loops.
Diffstat (limited to 'Libraries/LibCore')
-rw-r--r--Libraries/LibCore/EventLoop.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Libraries/LibCore/EventLoop.cpp b/Libraries/LibCore/EventLoop.cpp
index 3675111df7..805d2f67b0 100644
--- a/Libraries/LibCore/EventLoop.cpp
+++ b/Libraries/LibCore/EventLoop.cpp
@@ -365,7 +365,7 @@ void EventLoop::pump(WaitMode mode)
#endif
decltype(m_queued_events) new_event_queue;
new_event_queue.ensure_capacity(m_queued_events.size() + events.size());
- for (; i < events.size(); ++i)
+ for (++i; 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);