mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibJS: Fix string roots not being collected
Previously objects were the only heap allocated value. Now there are also strings. This replaces a usage of is_object with is_cell. Without this change strings could be garbage collected while still being used in an active scope.
This commit is contained in:
parent
8cf962a102
commit
17705d23fb
Notes:
sideshowbarker
2024-07-19 08:46:01 +09:00
Author: https://github.com/flostellbrink Commit: https://github.com/SerenityOS/serenity/commit/17705d23fbe Pull-request: https://github.com/SerenityOS/serenity/pull/1422
1 changed files with 2 additions and 2 deletions
|
@ -122,8 +122,8 @@ void Interpreter::collect_roots(Badge<Heap>, HashTable<Cell*>& roots)
|
|||
|
||||
for (auto& scope : m_scope_stack) {
|
||||
for (auto& it : scope.variables) {
|
||||
if (it.value.is_object())
|
||||
roots.set(it.value.as_object());
|
||||
if (it.value.is_cell())
|
||||
roots.set(it.value.as_cell());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue