mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
LibWeb: Add GC finalizer for DOM::Node
Now that the layout tree is also GC-allocated, we can't be messing with it from the DOM::Node destructor. Move everything to a GC finalizer so we know it runs before the GC sweep phase.
This commit is contained in:
parent
07a36c8f80
commit
c877eb47a2
2 changed files with 4 additions and 1 deletions
|
@ -73,7 +73,9 @@ Node::Node(Document& document, NodeType type)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Node::~Node()
|
Node::~Node() = default;
|
||||||
|
|
||||||
|
void Node::finalize()
|
||||||
{
|
{
|
||||||
if (layout_node() && layout_node()->parent())
|
if (layout_node() && layout_node()->parent())
|
||||||
layout_node()->parent()->remove_child(*layout_node());
|
layout_node()->parent()->remove_child(*layout_node());
|
||||||
|
|
|
@ -622,6 +622,7 @@ protected:
|
||||||
Node(Document&, NodeType);
|
Node(Document&, NodeType);
|
||||||
|
|
||||||
virtual void visit_edges(Cell::Visitor&) override;
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
virtual void finalize() override;
|
||||||
|
|
||||||
JS::GCPtr<Document> m_document;
|
JS::GCPtr<Document> m_document;
|
||||||
JS::GCPtr<Layout::Node> m_layout_node;
|
JS::GCPtr<Layout::Node> m_layout_node;
|
||||||
|
|
Loading…
Add table
Reference in a new issue