mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +00:00
Userland: Fix unnecessary heap allocation of singleton objects
In order to avoid having multiple instances, we were keeping a pointer to these singleton objects and only allocating them when it was null. We have `__cxa_guard_{acquire,release}` in the userland, so there's no need to do this dance, as the compiler will ensure that the constructors are only called once.
This commit is contained in:
parent
c1184c1fde
commit
7d11edbe17
9 changed files with 18 additions and 35 deletions
|
@ -8,10 +8,8 @@
|
|||
|
||||
WindowList& WindowList::the()
|
||||
{
|
||||
static WindowList* s_the;
|
||||
if (!s_the)
|
||||
s_the = new WindowList;
|
||||
return *s_the;
|
||||
static WindowList s_the;
|
||||
return s_the;
|
||||
}
|
||||
|
||||
Window* WindowList::find_parent(const Window& window)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue