diff --git a/Userland/Libraries/LibJS/Runtime/SymbolObject.cpp b/Userland/Libraries/LibJS/Runtime/SymbolObject.cpp index 5163d3487f..cfd637561a 100644 --- a/Userland/Libraries/LibJS/Runtime/SymbolObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/SymbolObject.cpp @@ -10,9 +10,9 @@ namespace JS { -SymbolObject* SymbolObject::create(Realm& realm, Symbol& primitive_symbol) +NonnullGCPtr SymbolObject::create(Realm& realm, Symbol& primitive_symbol) { - return realm.heap().allocate(realm, primitive_symbol, *realm.intrinsics().symbol_prototype()); + return *realm.heap().allocate(realm, primitive_symbol, *realm.intrinsics().symbol_prototype()); } SymbolObject::SymbolObject(Symbol& symbol, Object& prototype) diff --git a/Userland/Libraries/LibJS/Runtime/SymbolObject.h b/Userland/Libraries/LibJS/Runtime/SymbolObject.h index afc0b23519..fed0a8f1af 100644 --- a/Userland/Libraries/LibJS/Runtime/SymbolObject.h +++ b/Userland/Libraries/LibJS/Runtime/SymbolObject.h @@ -15,7 +15,7 @@ class SymbolObject : public Object { JS_OBJECT(SymbolObject, Object); public: - static SymbolObject* create(Realm&, Symbol&); + static NonnullGCPtr create(Realm&, Symbol&); virtual ~SymbolObject() override = default; diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index 572ee5e368..9ddc2f5d3a 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -544,7 +544,7 @@ ThrowCompletionOr Value::to_object(VM& vm) const // Symbol case SYMBOL_TAG: // Return a new Symbol object whose [[SymbolData]] internal slot is set to argument. See 20.4 for a description of Symbol objects. - return SymbolObject::create(realm, const_cast(as_symbol())); + return SymbolObject::create(realm, const_cast(as_symbol())).ptr(); // BigInt case BIGINT_TAG: // Return a new BigInt object whose [[BigIntData]] internal slot is set to argument. See 21.2 for a description of BigInt objects.