diff --git a/Userland/Libraries/LibJS/Heap/CellAllocator.h b/Userland/Libraries/LibJS/Heap/CellAllocator.h index 33ad2f2c51..592f54cc10 100644 --- a/Userland/Libraries/LibJS/Heap/CellAllocator.h +++ b/Userland/Libraries/LibJS/Heap/CellAllocator.h @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include #include @@ -61,7 +62,7 @@ class TypeIsolatingCellAllocator { public: using CellType = T; - CellAllocator allocator { sizeof(T) }; + NeverDestroyed allocator { sizeof(T) }; }; } diff --git a/Userland/Libraries/LibJS/Heap/Heap.h b/Userland/Libraries/LibJS/Heap/Heap.h index 57e056ba25..fda95d9266 100644 --- a/Userland/Libraries/LibJS/Heap/Heap.h +++ b/Userland/Libraries/LibJS/Heap/Heap.h @@ -101,9 +101,9 @@ private: Cell* allocate_cell() { will_allocate(sizeof(T)); - if constexpr (requires { T::cell_allocator.allocate_cell(*this); }) { + if constexpr (requires { T::cell_allocator.allocator.get().allocate_cell(*this); }) { if constexpr (IsSame) { - return T::cell_allocator.allocate_cell(*this); + return T::cell_allocator.allocator.get().allocate_cell(*this); } } return allocator_for_size(sizeof(T)).allocate_cell(*this);