mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 10:41:30 +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
Notes:
sideshowbarker
2024-07-17 10:39:39 +09:00
Author: https://github.com/Zaggy1024
Commit: 8626404ddb
Pull-request: https://github.com/SerenityOS/serenity/pull/19849
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/kleinesfilmroellchen
Reviewed-by: https://github.com/trflynn89
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