summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore/EventLoop.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-10-23 23:10:55 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-24 01:01:01 +0200
commitfa753ff863e3776cb1778890cca395ec030a17bd (patch)
tree3f853d17eaf0080cbd59113a694e44e243319cdf /Userland/Libraries/LibCore/EventLoop.cpp
parent3bed7d5a5ee5870de4805dd2bf47e0523e387e76 (diff)
downloadserenity-fa753ff863e3776cb1778890cca395ec030a17bd.zip
LibCore: Pop the main Core::EventLoop off the stack when destroyed
The main event loop pushes itself onto the event loop stack, and so it should also pop itself when destroyed. This will surface attempts to use the event loop stack after the main event loop has been destroyed.
Diffstat (limited to 'Userland/Libraries/LibCore/EventLoop.cpp')
-rw-r--r--Userland/Libraries/LibCore/EventLoop.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCore/EventLoop.cpp b/Userland/Libraries/LibCore/EventLoop.cpp
index fafd7aaae3..d6a5a95ac6 100644
--- a/Userland/Libraries/LibCore/EventLoop.cpp
+++ b/Userland/Libraries/LibCore/EventLoop.cpp
@@ -293,6 +293,11 @@ EventLoop::EventLoop([[maybe_unused]] MakeInspectable make_inspectable)
EventLoop::~EventLoop()
{
+ // NOTE: Pop the main event loop off of the stack when destroyed.
+ if (this == s_main_event_loop) {
+ s_event_loop_stack->take_last();
+ s_main_event_loop = nullptr;
+ }
}
bool connect_to_inspector_server()