summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/data/ClusterAlbumSet.java
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2012-09-04 16:53:42 +0800
committerOwen Lin <owenlin@google.com>2012-09-11 12:21:59 +0800
commit676d4762496eddae66930c6f8b0bae22a22b3ef6 (patch)
tree0dff10f4ec52047f90055f76572f09038acfb94b /src/com/android/gallery3d/data/ClusterAlbumSet.java
parentd9473d49b311306196327cc3083696911e857df3 (diff)
downloadandroid_packages_apps_Gallery2-676d4762496eddae66930c6f8b0bae22a22b3ef6.tar.gz
android_packages_apps_Gallery2-676d4762496eddae66930c6f8b0bae22a22b3ef6.tar.bz2
android_packages_apps_Gallery2-676d4762496eddae66930c6f8b0bae22a22b3ef6.zip
Ensure peekObject is called in the syncrhonization block.
bug: 7019598 Change-Id: If153287078826afc9827ea64364b4fb64f2b3a5f
Diffstat (limited to 'src/com/android/gallery3d/data/ClusterAlbumSet.java')
-rw-r--r--src/com/android/gallery3d/data/ClusterAlbumSet.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/data/ClusterAlbumSet.java b/src/com/android/gallery3d/data/ClusterAlbumSet.java
index a32ba87f4..cb212ba36 100644
--- a/src/com/android/gallery3d/data/ClusterAlbumSet.java
+++ b/src/com/android/gallery3d/data/ClusterAlbumSet.java
@@ -112,10 +112,13 @@ public class ClusterAlbumSet extends MediaSet implements ContentListener {
} else {
childPath = mPath.getChild(i);
}
- ClusterAlbum album = (ClusterAlbum) dataManager.peekMediaObject(
- childPath);
- if (album == null) {
- album = new ClusterAlbum(childPath, dataManager, this);
+
+ ClusterAlbum album;
+ synchronized (DataManager.LOCK) {
+ album = (ClusterAlbum) dataManager.peekMediaObject(childPath);
+ if (album == null) {
+ album = new ClusterAlbum(childPath, dataManager, this);
+ }
}
album.setMediaItems(clustering.getCluster(i));
album.setName(childName);