diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.cpp b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.cpp index 0044677a93c..7e02af21a12 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.cpp @@ -11,9 +11,9 @@ namespace JS { -AsyncFromSyncIterator* AsyncFromSyncIterator::create(Realm& realm, Iterator sync_iterator_record) +NonnullGCPtr AsyncFromSyncIterator::create(Realm& realm, Iterator sync_iterator_record) { - return realm.heap().allocate(realm, realm, sync_iterator_record); + return *realm.heap().allocate(realm, realm, sync_iterator_record); } AsyncFromSyncIterator::AsyncFromSyncIterator(Realm& realm, Iterator sync_iterator_record) diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.h b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.h index 451d3ac9530..16f8bd09939 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.h +++ b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.h @@ -17,7 +17,7 @@ class AsyncFromSyncIterator final : public Object { JS_OBJECT(AsyncFromSyncIterator, Object); public: - static AsyncFromSyncIterator* create(Realm&, Iterator sync_iterator_record); + static NonnullGCPtr create(Realm&, Iterator sync_iterator_record); virtual void initialize(Realm&) override; virtual ~AsyncFromSyncIterator() override = default; diff --git a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp index 4ce08d17042..4a06c9dedac 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.cpp @@ -202,7 +202,7 @@ Iterator create_async_from_sync_iterator(VM& vm, Iterator sync_iterator_record) // 1. Let asyncIterator be OrdinaryObjectCreate(%AsyncFromSyncIteratorPrototype%, « [[SyncIteratorRecord]] »). // 2. Set asyncIterator.[[SyncIteratorRecord]] to syncIteratorRecord. - auto* async_iterator = AsyncFromSyncIterator::create(realm, sync_iterator_record); + auto async_iterator = AsyncFromSyncIterator::create(realm, sync_iterator_record); // 3. Let nextMethod be ! Get(asyncIterator, "next"). auto next_method = MUST(async_iterator->get(vm.names.next));