mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +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:
parent
6c1fcc5f7e
commit
41941aeb10
Notes:
sideshowbarker
2024-07-17 07:06:47 +09:00
Author: https://github.com/awesomekling
Commit: 41941aeb10
Pull-request: https://github.com/SerenityOS/serenity/pull/22406
2 changed files with 9 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue