summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2012-04-17 12:12:03 +0800
committerOwen Lin <owenlin@google.com>2012-04-17 12:12:03 +0800
commit91adea8b4fc292b046b66c6501166fe7a151d253 (patch)
treefea96f50da61420ae970096ec961b9101e8a337a /src
parent483203d37da239d9c455239791c1defe2acdfa37 (diff)
downloadandroid_packages_apps_Gallery2-91adea8b4fc292b046b66c6501166fe7a151d253.tar.gz
android_packages_apps_Gallery2-91adea8b4fc292b046b66c6501166fe7a151d253.tar.bz2
android_packages_apps_Gallery2-91adea8b4fc292b046b66c6501166fe7a151d253.zip
Fix a concurrent issue in reload().
We need to hold the DataManager.LOCK when calling reload. Change-Id: If908c233bcd835effffc7750a7ef07f56a63136c fix: 6315479
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/data/LocalAlbumSet.java4
-rw-r--r--src/com/android/gallery3d/data/MtpDeviceSet.java7
2 files changed, 6 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/data/LocalAlbumSet.java b/src/com/android/gallery3d/data/LocalAlbumSet.java
index 56c84f337..47e3bd431 100644
--- a/src/com/android/gallery3d/data/LocalAlbumSet.java
+++ b/src/com/android/gallery3d/data/LocalAlbumSet.java
@@ -207,7 +207,6 @@ public class LocalAlbumSet extends MediaSet
for (BucketEntry entry : entries) {
MediaSet album = getLocalAlbum(dataManager,
mType, mPath, entry.bucketId, entry.bucketName);
- album.reload();
albums.add(album);
}
return albums;
@@ -270,6 +269,9 @@ public class LocalAlbumSet extends MediaSet
if (mLoadBuffer != null) {
mAlbums = mLoadBuffer;
mLoadBuffer = null;
+ for (MediaSet album : mAlbums) {
+ album.reload();
+ }
mDataVersion = nextVersionNumber();
}
return mDataVersion;
diff --git a/src/com/android/gallery3d/data/MtpDeviceSet.java b/src/com/android/gallery3d/data/MtpDeviceSet.java
index dd79bc1cb..46cc0fc68 100644
--- a/src/com/android/gallery3d/data/MtpDeviceSet.java
+++ b/src/com/android/gallery3d/data/MtpDeviceSet.java
@@ -76,10 +76,6 @@ public class MtpDeviceSet extends MediaSet
}
}
Collections.sort(result, MediaSetUtils.NAME_COMPARATOR);
-
- for (int i = 0, n = result.size(); i < n; ++i) {
- result.get(i).reload();
- }
return result;
}
}
@@ -122,6 +118,9 @@ public class MtpDeviceSet extends MediaSet
if (mLoadBuffer != null) {
mDeviceSet = mLoadBuffer;
mLoadBuffer = null;
+ for (MediaSet device : mDeviceSet) {
+ device.reload();
+ }
mDataVersion = nextVersionNumber();
}
return mDataVersion;