mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:17:45 +00:00
LibJS: Visit WeakMap's values as long as their keys were not collected
While the WeakMap only holds a weak reference to its keys, their accompanying values should be kept alive as long as they're accessible.
This commit is contained in:
parent
073a1dec16
commit
b92871f7ef
2 changed files with 8 additions and 0 deletions
|
@ -29,4 +29,11 @@ void WeakMap::remove_swept_cells(Badge<Heap>, Span<Cell*> cells)
|
|||
m_values.remove(cell);
|
||||
}
|
||||
|
||||
void WeakMap::visit_edges(Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
for (auto& entry : m_values)
|
||||
visitor.visit(entry.value);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue