summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasu Nori <vnori@google.com>2011-01-04 13:18:17 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-01-04 13:18:17 -0800
commitcd7f598122c30b155bd8e18f8e36eff5424e20ef (patch)
tree0b042f0c4eb7815face2ebc637e3357e6a774cdb
parentb341df446ba852d6c092da7f76dc5b8d685047e7 (diff)
parent36c4cec85346a11e136b0f95baae2a8fe1db59f2 (diff)
downloadframeworks_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.java18
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();
}
}