mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 17:05:06 +00: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:
parent
57a04c536c
commit
41a3c19cfe
18 changed files with 100 additions and 54 deletions
|
@ -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]() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue