diff options
author | Vasu Nori <vnori@google.com> | 2011-01-04 13:18:17 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-01-04 13:18:17 -0800 |
commit | cd7f598122c30b155bd8e18f8e36eff5424e20ef (patch) | |
tree | 0b042f0c4eb7815face2ebc637e3357e6a774cdb | |
parent | b341df446ba852d6c092da7f76dc5b8d685047e7 (diff) | |
parent | 36c4cec85346a11e136b0f95baae2a8fe1db59f2 (diff) | |
download | frameworks_base-cd7f598122c30b155bd8e18f8e36eff5424e20ef.zip frameworks_base-cd7f598122c30b155bd8e18f8e36eff5424e20ef.tar.gz frameworks_base-cd7f598122c30b155bd8e18f8e36eff5424e20ef.tar.bz2 |
Merge "don't call methods doing database lock from a synchronized block"
-rw-r--r-- | core/java/android/database/sqlite/SQLiteClosable.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/core/java/android/database/sqlite/SQLiteClosable.java b/core/java/android/database/sqlite/SQLiteClosable.java index 93f9a71..01e9fb3 100644 --- a/core/java/android/database/sqlite/SQLiteClosable.java +++ b/core/java/android/database/sqlite/SQLiteClosable.java @@ -38,20 +38,22 @@ public abstract class SQLiteClosable { } public void releaseReference() { + boolean refCountIsZero = false; synchronized(this) { - mReferenceCount--; - if (mReferenceCount == 0) { - onAllReferencesReleased(); - } + refCountIsZero = --mReferenceCount == 0; + } + if (refCountIsZero) { + onAllReferencesReleased(); } } public void releaseReferenceFromContainer() { + boolean refCountIsZero = false; synchronized(this) { - mReferenceCount--; - if (mReferenceCount == 0) { - onAllReferencesReleasedFromContainer(); - } + refCountIsZero = --mReferenceCount == 0; + } + if (refCountIsZero) { + onAllReferencesReleasedFromContainer(); } } |