1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

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

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