Skip to content

Commit 00002c6

Browse files
shannonboothgmta
authored andcommitted
LibWeb/HTML: Unregister ESO during finalize phase
It is generally safer for GC cells to do cleanup work during the finalize phase.
1 parent 3c0b125 commit 00002c6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Libraries/LibWeb/HTML/Scripting/Environments.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ EnvironmentSettingsObject::EnvironmentSettingsObject(NonnullOwnPtr<JS::Execution
4444
responsible_event_loop().register_environment_settings_object({}, *this);
4545
}
4646

47-
EnvironmentSettingsObject::~EnvironmentSettingsObject()
47+
void EnvironmentSettingsObject::finalize()
4848
{
4949
responsible_event_loop().unregister_environment_settings_object({}, *this);
50+
Base::finalize();
5051
}
5152

5253
void EnvironmentSettingsObject::initialize(JS::Realm& realm)

Libraries/LibWeb/HTML/Scripting/Environments.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct EnvironmentSettingsObject : public Environment {
7676
GC_CELL(EnvironmentSettingsObject, Environment);
7777

7878
public:
79-
virtual ~EnvironmentSettingsObject() override;
79+
virtual void finalize() override;
8080
virtual void initialize(JS::Realm&) override;
8181

8282
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-target-browsing-context

0 commit comments

Comments
 (0)