diff options
author | 2016-07-12 18:48:52 -0700 | |
---|---|---|
committer | 2016-07-13 19:09:25 +0000 | |
commit | 98980cdfff34d1cace1ab60fa54e248c0ee8bc8e (patch) | |
tree | 820318d9282bc0e59105051beb2794fa69718a76 | |
parent | 0b4750165ee3270225fcc99e3ffc49ce69f83e48 (diff) |
Fix use-after-free in vector drawable animation
Added a strong pointer to hold reference to VD in the animation,
so that VD will not be released before animation is finished/destroyed.
BUG: 29438210
Change-Id: I311cd83043f988640de44f637cb474baada9b5ca
-rw-r--r-- | libs/hwui/PropertyValuesAnimatorSet.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/hwui/PropertyValuesAnimatorSet.h b/libs/hwui/PropertyValuesAnimatorSet.h index 49021bc82825..f9274e173536 100644 --- a/libs/hwui/PropertyValuesAnimatorSet.h +++ b/libs/hwui/PropertyValuesAnimatorSet.h @@ -60,7 +60,7 @@ public: virtual uint32_t dirtyMask(); bool isInfinite() { return mIsInfinite; } void setVectorDrawable(VectorDrawableRoot* vd) { mVectorDrawable = vd; } - VectorDrawableRoot* getVectorDrawable() const { return mVectorDrawable; } + VectorDrawableRoot* getVectorDrawable() const { return mVectorDrawable.get(); } AnimationListener* getOneShotListener() { return mOneShotListener.get(); } void clearOneShotListener() { mOneShotListener = nullptr; } uint32_t getRequestId() const { return mRequestId; } @@ -78,7 +78,7 @@ private: std::vector< std::unique_ptr<PropertyAnimator> > mAnimators; float mLastFraction = 0.0f; bool mInitialized = false; - VectorDrawableRoot* mVectorDrawable = nullptr; + sp<VectorDrawableRoot> mVectorDrawable; bool mIsInfinite = false; // This request id gets incremented (on UI thread only) when a new request to modfiy the // lifecycle of an animation happens, namely when start/end/reset/reverse is called. |