mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb/SVG: Don't crash when changing SVG image href
Previously, a segfault could occur if `m_resource_request` was replaced before its callbacks were invoked.
This commit is contained in:
parent
5b45223d5f
commit
93a35895ae
Notes:
github-actions[bot]
2025-07-12 11:15:02 +00:00
Author: https://github.com/tcl3
Commit: 93a35895ae
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5406
Reviewed-by: https://github.com/gmta ✅
1 changed files with 2 additions and 2 deletions
|
@ -159,9 +159,9 @@ void SVGImageElement::fetch_the_document(URL::URL const& url)
|
|||
m_load_event_delayer.emplace(document());
|
||||
m_resource_request = HTML::SharedResourceRequest::get_or_create(realm(), document().page(), url);
|
||||
m_resource_request->add_callbacks(
|
||||
[this] {
|
||||
[this, resource_request = GC::Root { m_resource_request }] {
|
||||
m_load_event_delayer.clear();
|
||||
auto image_data = m_resource_request->image_data();
|
||||
auto image_data = resource_request->image_data();
|
||||
if (image_data->is_animated() && image_data->frame_count() > 1) {
|
||||
m_current_frame_index = 0;
|
||||
m_animation_timer->set_interval(image_data->frame_duration(0));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue