mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 17:24:48 -05:00
LibWeb/HTML: Use finalize to clean up MessagePort instances
This commit is contained in:
parent
0b2c80e503
commit
e767029e24
Notes:
github-actions[bot]
2025-01-02 10:39:57 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/e767029e243 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3070 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/konradekk
2 changed files with 9 additions and 5 deletions
|
@ -47,11 +47,7 @@ MessagePort::MessagePort(JS::Realm& realm)
|
|||
all_message_ports().set(this);
|
||||
}
|
||||
|
||||
MessagePort::~MessagePort()
|
||||
{
|
||||
all_message_ports().remove(this);
|
||||
disentangle();
|
||||
}
|
||||
MessagePort::~MessagePort() = default;
|
||||
|
||||
void MessagePort::for_each_message_port(Function<void(MessagePort&)> callback)
|
||||
{
|
||||
|
@ -65,6 +61,13 @@ void MessagePort::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(MessagePort);
|
||||
}
|
||||
|
||||
void MessagePort::finalize()
|
||||
{
|
||||
Base::finalize();
|
||||
all_message_ports().remove(this);
|
||||
disentangle();
|
||||
}
|
||||
|
||||
void MessagePort::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
|
|
|
@ -68,6 +68,7 @@ private:
|
|||
explicit MessagePort(JS::Realm&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void finalize() override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
bool is_entangled() const;
|
||||
|
|
Loading…
Reference in a new issue