From 04359995a7ff60cb2c889148ad4d823f2dc7203c Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sun, 15 Aug 2021 00:04:00 +0300 Subject: [PATCH] LibJS: Exclude FinalizationRegistries with queued cleanup jobs from GC This is done by just adding them to the list of GC roots, which prevents the VM from trying to run cleanup job of garbage collected registries. --- Userland/Libraries/LibJS/Runtime/VM.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index 048004e61d0..f8ebdab071f 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -120,6 +120,9 @@ void VM::gather_roots(HashTable& roots) for (auto* job : m_promise_jobs) roots.set(job); + + for (auto* finalization_registry : m_finalization_registry_cleanup_jobs) + roots.set(finalization_registry); } Symbol* VM::get_global_symbol(const String& description)