Skip to content

Commit

Permalink
fix(core): fix invalid animation crash (#4117)
Browse files Browse the repository at this point in the history
  • Loading branch information
etkmao authored and wwwcg committed Nov 7, 2024
1 parent 2f3d984 commit b953a7a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions dom/src/dom/animation/animation_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,14 @@ void AnimationManager::UpdateAnimations() {
auto now = footstone::time::MonotonicallyIncreasingTime();
std::unordered_map<uint32_t, std::shared_ptr<DomNode>> update_node_map;
// xcode crash if we change for to loop
for (std::vector<std::shared_ptr<Animation>>::size_type i = 0; i < active_animations_.size(); ++i) {
UpdateAnimation(active_animations_[i], now, update_node_map);
std::vector<std::shared_ptr<Animation>> loop_animations = active_animations_;
for (size_t i = 0; i < loop_animations.size(); ++i) {
auto it = std::find(active_animations_.begin(), active_animations_.end(), loop_animations[i]);
if (it != active_animations_.end()) {
UpdateAnimation(loop_animations[i], now, update_node_map);
}
}
loop_animations.clear();
std::vector<std::shared_ptr<DomNode>> update_nodes;
update_nodes.reserve(update_node_map.size());
for (const auto& [key, value]: update_node_map) {
Expand Down

0 comments on commit b953a7a

Please sign in to comment.