LibCore: Store the event loop stack as a function-scope thread_local

By allocating the event loop stack onto the heap, we were leaking it
when exiting. This way, we should avoid ASAN being unhappy with us.
This commit is contained in:
Zaggy1024 2023-08-02 23:03:54 -05:00 committed by Andrew Kaster
parent 78e1defbfe
commit 8626404ddb

View file

@ -17,11 +17,11 @@
namespace Core {
namespace {
thread_local Vector<EventLoop&>* s_event_loop_stack;
Vector<EventLoop&>& event_loop_stack()
{
if (!s_event_loop_stack)
s_event_loop_stack = new Vector<EventLoop&>;
thread_local OwnPtr<Vector<EventLoop&>> s_event_loop_stack = nullptr;
if (s_event_loop_stack == nullptr)
s_event_loop_stack = make<Vector<EventLoop&>>();
return *s_event_loop_stack;
}
}