mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:28:11 +00:00
LibWeb: Add GC finalizer to DOM::NodeIterator
It's potentially unsafe to access `m_root` in the destructor since it may have been swept, so move unregistration of the NodeIterator into a GC finalizer instead.
This commit is contained in:
parent
e7da96acaf
commit
eda566d112
2 changed files with 5 additions and 1 deletions
|
@ -19,8 +19,11 @@ NodeIterator::NodeIterator(Node& root)
|
|||
root.document().register_node_iterator({}, *this);
|
||||
}
|
||||
|
||||
NodeIterator::~NodeIterator()
|
||||
NodeIterator::~NodeIterator() = default;
|
||||
|
||||
void NodeIterator::finalize()
|
||||
{
|
||||
Base::finalize();
|
||||
m_root->document().unregister_node_iterator({}, *this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue