diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-06-10 17:56:08 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2011-06-10 18:13:31 -0700 |
commit | fc9ff4c834c5b3a3c4b024b89375d6c329092791 (patch) | |
tree | 9b1b27bb37a8bcb67724cdf6e38e00cf816fca53 /core/java/android/os | |
parent | 24572375323dee79e3b456af07640ca194fd40bf (diff) | |
download | frameworks_base-fc9ff4c834c5b3a3c4b024b89375d6c329092791.zip frameworks_base-fc9ff4c834c5b3a3c4b024b89375d6c329092791.tar.gz frameworks_base-fc9ff4c834c5b3a3c4b024b89375d6c329092791.tar.bz2 |
Always clear the Message when recycled.
Clear the Message when it is recycled, even if it will not go
back into the Message pool. This makes the behavior of recycle()
more consistent and ensures that the Message does not hold onto
other object after it has been recycled (useful in case there are
stale references to the Message lingering elsewhere).
Change-Id: I26b6a4b629f9c0b6bed70fdc42734919f30e64c4
Diffstat (limited to 'core/java/android/os')
-rw-r--r-- | core/java/android/os/Message.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/java/android/os/Message.java b/core/java/android/os/Message.java index 557e53f..844ed6a 100644 --- a/core/java/android/os/Message.java +++ b/core/java/android/os/Message.java @@ -249,9 +249,10 @@ public final class Message implements Parcelable { * freed. */ public void recycle() { + clearForRecycle(); + synchronized (sPoolSync) { if (sPoolSize < MAX_POOL_SIZE) { - clearForRecycle(); next = sPool; sPool = this; sPoolSize++; |