mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25:12 +00:00
LibWeb: Don't access SharedImageRequest::m_document in destructor
It's not safe to access m_document here since GC may have deleted it by the time we're being deleted. Instead, move this to a finalize() override, since those are guaranteed to be called while both objects are still alive.
This commit is contained in:
@@ -40,8 +40,11 @@ SharedImageRequest::SharedImageRequest(JS::NonnullGCPtr<Page> page, AK::URL url,
|
||||
{
|
||||
}
|
||||
|
||||
SharedImageRequest::~SharedImageRequest()
|
||||
SharedImageRequest::~SharedImageRequest() = default;
|
||||
|
||||
void SharedImageRequest::finalize()
|
||||
{
|
||||
Base::finalize();
|
||||
auto& shared_image_requests = m_document->shared_image_requests();
|
||||
shared_image_requests.remove(m_url);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user