diff options
author | John Reck <jreck@google.com> | 2014-04-30 14:19:56 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2014-04-30 14:19:56 -0700 |
commit | 52622668f91c69ec718b356d2e0f8555fc88435f (patch) | |
tree | 85853f422b9fca99135bc08c2c1d5bc2be47a5c6 /libs | |
parent | 406c51b360cb224e2cb4773eabd04d05d29793f8 (diff) | |
download | frameworks_base-52622668f91c69ec718b356d2e0f8555fc88435f.zip frameworks_base-52622668f91c69ec718b356d2e0f8555fc88435f.tar.gz frameworks_base-52622668f91c69ec718b356d2e0f8555fc88435f.tar.bz2 |
Use resize, not reserve
Reserve ensures the underlying buffer is the correct size, but
iterating across it is not necessarily valid. Use resize() instead
to ensure that the iterator access is valid
Change-Id: I35ff5f4416bb94cf4ce2c6acf72ffd17ab3e523a
Diffstat (limited to 'libs')
-rw-r--r-- | libs/hwui/RenderNode.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index dcd6bda..7a9c181 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -119,7 +119,7 @@ void RenderNode::pushStagingChanges(TreeInfo& info) { mProperties = mStagingProperties; } if (mNeedsAnimatorsSync) { - mAnimators.reserve(mStagingAnimators.size()); + mAnimators.resize(mStagingAnimators.size()); std::vector< sp<RenderPropertyAnimator> >::iterator it; // hint: this means copy_if_not() it = std::remove_copy_if(mStagingAnimators.begin(), mStagingAnimators.end(), |