Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3a0ee5c authored by Sally Qi's avatar Sally Qi
Browse files

Fix the crash in AnimatorManager.

If we have >1 mAnimators and also the animator target changes,
`onAnimatorTargetChanged` function will erase mAnimators vector, while
in AnimatorManager::pushStaging, the process still does the loop for
mAnimators. Thus the crash happens.

Bug: 327666562
Test: n/a
Change-Id: I928185a2654b49660e226dcc89a2bc116cec870f
parent 370ec60a
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -90,7 +90,13 @@ void AnimatorManager::pushStaging() {
        }
        mCancelAllAnimators = false;
    } else {
        for (auto& animator : mAnimators) {
        // create a copy of mAnimators as onAnimatorTargetChanged can erase mAnimators.
        FatVector<sp<BaseRenderNodeAnimator>> animators;
        animators.reserve(mAnimators.size());
        for (const auto& animator : mAnimators) {
            animators.push_back(animator);
        }
        for (auto& animator : animators) {
            animator->pushStaging(mAnimationHandle->context());
        }
    }