mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 04:55:15 +00:00
LibWeb/Animations: Keep a safe copy of associated animations
The associated animations list might be modified on the time change event. This means that we can't safely iterate over the hashmap during this period. This fixes a crash in: - css/css-animations/CSSAnimation-effect.tentative.html
This commit is contained in:
parent
906b7bf4e3
commit
43c30e4f7b
Notes:
github-actions[bot]
2024-12-30 10:05:55 +00:00
Author: https://github.com/LucasChollet Commit: https://github.com/LadybirdBrowser/ladybird/commit/43c30e4f7b0 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3066
1 changed files with 5 additions and 1 deletions
|
@ -24,8 +24,12 @@ void AnimationTimeline::set_current_time(Optional<double> value)
|
|||
}
|
||||
|
||||
m_current_time = value;
|
||||
for (auto& animation : m_associated_animations)
|
||||
// The loop might modify the content of m_associated_animations, so let's iterate over a copy.
|
||||
auto temporary_copy = GC::RootVector<GC::Ref<Animation>>(vm().heap());
|
||||
temporary_copy.extend(m_associated_animations.values());
|
||||
for (auto& animation : temporary_copy) {
|
||||
animation->notify_timeline_time_did_change();
|
||||
}
|
||||
}
|
||||
|
||||
void AnimationTimeline::set_associated_document(GC::Ptr<DOM::Document> document)
|
||||
|
|
Loading…
Add table
Reference in a new issue