mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 04:52:06 +02:00
LibWeb: Make HTML::DecodedImageData to be GC-allocated
This change fixes GC-leak caused by following mutual dependency: - SVGDecodedImageData owns JS::Handle for Page. - SVGDecodedImageData is owned by visited objects. by making everything inherited from HTML::DecodedImageData and ListOfAvailableImages to be GC-allocated. Generally, if visited object has a handle, very likely we leak everything visited from object in a handle.
This commit is contained in:
committed by
Andreas Kling
parent
57a04c536c
commit
41a3c19cfe
Notes:
sideshowbarker
2024-07-17 07:06:47 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/41a3c19cfe Pull-request: https://github.com/SerenityOS/serenity/pull/22267 Reviewed-by: https://github.com/shannonbooth ✅
@@ -715,7 +715,7 @@ void HTMLImageElement::react_to_changes_in_the_environment()
|
||||
|
||||
// FIXME: 13. End the synchronous section, continuing the remaining steps in parallel.
|
||||
|
||||
auto step_15 = [this](String const& selected_source, JS::NonnullGCPtr<ImageRequest> image_request, ListOfAvailableImages::Key const& key, NonnullRefPtr<DecodedImageData> const& image_data) {
|
||||
auto step_15 = [this](String const& selected_source, JS::NonnullGCPtr<ImageRequest> image_request, ListOfAvailableImages::Key const& key, JS::NonnullGCPtr<DecodedImageData> image_data) {
|
||||
// 15. Queue an element task on the DOM manipulation task source given the img element and the following steps:
|
||||
queue_an_element_task(HTML::Task::Source::DOMManipulation, [this, selected_source, image_request, key, image_data] {
|
||||
// 1. FIXME: If the img element has experienced relevant mutations since this algorithm started, then let pending request be null and abort these steps.
|
||||
@@ -789,7 +789,7 @@ void HTMLImageElement::react_to_changes_in_the_environment()
|
||||
VERIFY(image_request->shared_image_request());
|
||||
auto image_data = image_request->shared_image_request()->image_data();
|
||||
image_request->set_image_data(image_data);
|
||||
step_15(selected_source, image_request, key, NonnullRefPtr(*image_data));
|
||||
step_15(selected_source, image_request, key, *image_data);
|
||||
});
|
||||
},
|
||||
[this]() {
|
||||
|
||||
Reference in New Issue
Block a user