mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
LibWeb: Don't visit registered document observers from Document
`DocumentObserver` register itself in Document` from constructor and unregister itself from `finalize()`. The problem is that `finalize()` won't be invoked for as long as `DocumentObserver` is visited by `Document`. By not visiting registered observers from `Document` we move this responsibility to object that allocated observer, which is always exactly what we want, e.g. once `SVGUseElement` that uses observer is gone, observer won't be visited anymore which will lead to `finalize()` being called.
This commit is contained in:
parent
9e1e4f3b15
commit
52b4f2a40a
Notes:
github-actions[bot]
2025-07-29 22:56:31 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 52b4f2a40a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5646
2 changed files with 3 additions and 2 deletions
|
@ -581,7 +581,6 @@ void Document::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_scripts_to_execute_in_order_as_soon_as_possible);
|
||||
visitor.visit(m_scripts_to_execute_as_soon_as_possible);
|
||||
visitor.visit(m_node_iterators);
|
||||
visitor.visit(m_document_observers);
|
||||
visitor.visit(m_document_observers_being_notified);
|
||||
visitor.visit(m_pending_scroll_event_targets);
|
||||
visitor.visit(m_pending_scrollend_event_targets);
|
||||
|
|
|
@ -1081,7 +1081,9 @@ private:
|
|||
|
||||
HashTable<GC::Ptr<NodeIterator>> m_node_iterators;
|
||||
|
||||
HashTable<GC::Ref<DocumentObserver>> m_document_observers;
|
||||
// Document should not visit DocumentObserver to avoid leaks.
|
||||
// It's responsibility of object that requires DocumentObserver to keep it alive.
|
||||
HashTable<GC::RawRef<DocumentObserver>> m_document_observers;
|
||||
Vector<GC::Ref<DocumentObserver>> m_document_observers_being_notified;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#is-initial-about:blank
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue