1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:27:45 +00:00

LibWeb: Use a WeakPtr for DocumentFragment's "host" field

We had a reference cycle between fragments and their hosts.
This commit is contained in:
Andreas Kling 2022-03-14 12:46:14 +01:00
parent 7a82a6dfe8
commit fdb647c097
2 changed files with 12 additions and 4 deletions

View file

@ -26,13 +26,14 @@ public:
virtual FlyString node_name() const override { return "#document-fragment"; }
RefPtr<Element> host() { return m_host; }
const RefPtr<Element> host() const { return m_host; }
Element* host() { return m_host; }
Element const* host() const { return m_host; }
void set_host(Element& host) { m_host = host; }
private:
RefPtr<Element> m_host;
// https://dom.spec.whatwg.org/#concept-documentfragment-host
WeakPtr<Element> m_host;
};
}