diff --git a/Libraries/LibWeb/Animations/AnimationTimeline.cpp b/Libraries/LibWeb/Animations/AnimationTimeline.cpp index 6761da42ec7..f906a5810b8 100644 --- a/Libraries/LibWeb/Animations/AnimationTimeline.cpp +++ b/Libraries/LibWeb/Animations/AnimationTimeline.cpp @@ -24,8 +24,12 @@ void AnimationTimeline::set_current_time(Optional 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>(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 document)