diff options
author | Owen Lin <owenlin@google.com> | 2012-09-04 16:53:42 +0800 |
---|---|---|
committer | Owen Lin <owenlin@google.com> | 2012-09-11 12:21:59 +0800 |
commit | 676d4762496eddae66930c6f8b0bae22a22b3ef6 (patch) | |
tree | 0dff10f4ec52047f90055f76572f09038acfb94b /src/com/android/gallery3d/data/ClusterAlbumSet.java | |
parent | d9473d49b311306196327cc3083696911e857df3 (diff) | |
download | android_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.java | 11 |
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); |