mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00:00
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:
parent
78e1defbfe
commit
8626404ddb
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue