mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:37:45 +00:00
LibWeb: Fix memory leak in CSS::ImageStyleValue
Before this change, whenever ImageStyleValue had a non-null `m_image_request`, it was always leaked along with everything related to the document to which this value belongs. The issue arises due to the use of `JS::Handle` for the image request, as it introduces a cyclic dependency where `ImageRequest` prevents the `CSSStyleSheet`, that owns `ImageStyleValue`, from being deallocated: - ImageRequest - FetchController - FetchParams - Window - HTMLDocument - HTMLHtmlElement - HTMLBodyElement - Text - HTMLHeadElement - Text - HTMLMetaElement - Text - HTMLTitleElement - Text - HTMLStyleElement - CSSStyleSheet This change solves this by visiting `m_image_request` from `visit_edges` instead of introducing new heap root by using `JS::Handle`.
This commit is contained in:
parent
d81b0e3c86
commit
707ca984bd
3 changed files with 22 additions and 1 deletions
|
@ -85,6 +85,8 @@ protected:
|
|||
private:
|
||||
bool set_a_css_declaration(PropertyID, NonnullRefPtr<StyleValue const>, Important);
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
Vector<StyleProperty> m_properties;
|
||||
HashMap<DeprecatedString, StyleProperty> m_custom_properties;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue