mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:37:37 +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
1 changed files with 3 additions and 3 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue