LibWeb: Make Nodes actually ref/unref their Document

Oops, it seems like I implemented all of the "nodes keep the document
alive" mechanism except the part where the functions are actually
called. :^)

Fixes #3811.
This commit is contained in:
Andreas Kling 2020-10-22 18:48:01 +02:00
parent 460d3e3969
commit 5fdc8c14a6
Notes: sideshowbarker 2024-07-19 01:48:16 +09:00

View File

@ -54,12 +54,14 @@ Node::Node(Document& document, NodeType type)
, m_document(&document)
, m_type(type)
{
m_document->ref_from_node({});
}
Node::~Node()
{
if (layout_node() && layout_node()->parent())
layout_node()->parent()->remove_child(*layout_node());
m_document->unref_from_node({});
}
const HTML::HTMLAnchorElement* Node::enclosing_link_element() const