diff options
author | kleines Filmröllchen <filmroellchen@serenityos.org> | 2022-02-08 23:25:18 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-13 23:06:53 +0100 |
commit | 716a3429fa2693bc512b19d25e524c34b58049c5 (patch) | |
tree | 2f83d720c64fbf8ffe953df59386faf8aac89a14 /Userland/Libraries | |
parent | 93496af02b97167c412c9049be6a19b6b4900541 (diff) | |
download | serenity-716a3429fa2693bc512b19d25e524c34b58049c5.zip |
LibCore: Fix event loop stacks on non-main threads
Previously, event loop stacks on non-main threads would always crash
because the condition for "am I the lowest-stacked loop" was still
"am I the main loop", which of course is no longer sensible. A simple
switch to `is_instantiated` fixes this.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibCore/EventLoop.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibCore/EventLoop.cpp b/Userland/Libraries/LibCore/EventLoop.cpp index dd51c3d41b..2c2a9f6fe1 100644 --- a/Userland/Libraries/LibCore/EventLoop.cpp +++ b/Userland/Libraries/LibCore/EventLoop.cpp @@ -396,14 +396,14 @@ public: EventLoopPusher(EventLoop& event_loop) : m_event_loop(event_loop) { - if (!is_main_event_loop()) { + if (EventLoop::has_been_instantiated()) { m_event_loop.take_pending_events_from(EventLoop::current()); s_event_loop_stack->append(event_loop); } } ~EventLoopPusher() { - if (!is_main_event_loop()) { + if (EventLoop::has_been_instantiated()) { s_event_loop_stack->take_last(); EventLoop::current().take_pending_events_from(m_event_loop); } |