summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Doris Liu <tianliu@google.com> 2016-10-08 23:56:52 +0000
committer android-build-merger <android-build-merger@google.com> 2016-10-08 23:56:52 +0000
commit5ef10f1d26993ff1bfa3e4772d38d3db56ffc38f (patch)
treebde92ef0802f32c0f25549fc3017608fe04be250
parent437b8c95a803736a8917bd2b89c5653ba48976b6 (diff)
parent4a1ea9ba7ed48b2c0e5096dbc0dd10b13830de50 (diff)
Support calling start() in onAnimationFinished(...) in AVD am: 679fe6ab6f
am: 4a1ea9ba7e Change-Id: If343048fcbe8e2af46b6cdfcd5953c0d5ffa6c4e
-rw-r--r--libs/hwui/PropertyValuesAnimatorSet.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/hwui/PropertyValuesAnimatorSet.cpp b/libs/hwui/PropertyValuesAnimatorSet.cpp
index 38fb70a92e43..e3258e3c1a48 100644
--- a/libs/hwui/PropertyValuesAnimatorSet.cpp
+++ b/libs/hwui/PropertyValuesAnimatorSet.cpp
@@ -46,8 +46,17 @@ PropertyValuesAnimatorSet::PropertyValuesAnimatorSet()
void PropertyValuesAnimatorSet::onFinished(BaseRenderNodeAnimator* animator) {
if (mOneShotListener.get()) {
- mOneShotListener->onAnimationFinished(animator);
+ sp<AnimationListener> listener = std::move(mOneShotListener);
+ // Set the listener to nullptr before the onAnimationFinished callback, rather than after,
+ // for two reasons:
+ // 1) We need to prevent changes to mOneShotListener during the onAnimationFinished
+ // callback (specifically in AnimationListenerBridge::onAnimationFinished(...) from
+ // triggering dtor of the bridge and potentially unsafely re-entering
+ // AnimationListenerBridge::onAnimationFinished(...).
+ // 2) It's possible that there are changes to the listener during the callback, therefore
+ // we need to reset the listener before the callback rather than afterwards.
mOneShotListener = nullptr;
+ listener->onAnimationFinished(animator);
}
}