summaryrefslogtreecommitdiff
path: root/libs/hwui/AnimationContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/AnimationContext.cpp')
-rw-r--r--libs/hwui/AnimationContext.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/libs/hwui/AnimationContext.cpp b/libs/hwui/AnimationContext.cpp
index ec44de369f1f..732f4f1967ae 100644
--- a/libs/hwui/AnimationContext.cpp
+++ b/libs/hwui/AnimationContext.cpp
@@ -31,6 +31,14 @@ AnimationContext::AnimationContext(renderthread::TimeLord& clock)
}
AnimationContext::~AnimationContext() {
+ startFrame();
+ while (mCurrentFrameAnimations.mNextHandle) {
+ AnimationHandle* current = mCurrentFrameAnimations.mNextHandle;
+ AnimatorManager& animators = current->mRenderNode->animators();
+ animators.endAllAnimators();
+ LOG_ALWAYS_FATAL_IF(mCurrentFrameAnimations.mNextHandle == current,
+ "Animate failed to remove from current frame list!");
+ }
}
void AnimationContext::addAnimatingRenderNode(RenderNode& node) {
@@ -96,11 +104,18 @@ void AnimationHandle::notifyAnimationsRan() {
if (mRenderNode->animators().hasAnimators()) {
mContext.addAnimationHandle(this);
} else {
- mRenderNode->animators().setAnimationHandle(NULL);
- delete this;
+ release();
}
}
+void AnimationHandle::release() {
+ LOG_ALWAYS_FATAL_IF(mRenderNode->animators().hasAnimators(),
+ "Releasing the handle for an RenderNode with outstanding animators!");
+ removeFromList();
+ mRenderNode->animators().setAnimationHandle(NULL);
+ delete this;
+}
+
void AnimationHandle::insertAfter(AnimationHandle* prev) {
removeFromList();
mNextHandle = prev->mNextHandle;