OSDN Git Service

Fix race condition
authorJohn Reck <jreck@google.com>
Fri, 1 Mar 2013 18:23:42 +0000 (10:23 -0800)
committerJohn Reck <jreck@google.com>
Fri, 1 Mar 2013 18:23:42 +0000 (10:23 -0800)
Change-Id: I6cf9207d067d4c0c3c4271d6ce6f44b213d7296b

src/com/android/photos/data/GalleryBitmapPool.java

index cddc160..4c3279f 100644 (file)
@@ -46,11 +46,9 @@ public class GalleryBitmapPool {
         mCapacityBytes = capacityBytes;
     }
 
-    private static GalleryBitmapPool sInstance;
+    private static GalleryBitmapPool sInstance = new GalleryBitmapPool(CAPACITY_BYTES);
+
     public static GalleryBitmapPool getInstance() {
-        if (sInstance == null) {
-            sInstance = new GalleryBitmapPool(CAPACITY_BYTES);
-        }
         return sInstance;
     }