summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkaiyiz <kaiyiz@codeaurora.org>2013-09-18 17:36:34 +0800
committeremancebo <emancebo@cyngn.com>2014-09-04 10:40:17 -0700
commitea1a3dad769cd1a48cd04a2df2ebe26e443cb5a1 (patch)
tree0b07507f05178c437c30d86596d7c5a322a0a86b /src
parent79dfda8b8dd72124236570c01e2cf6542a5c8138 (diff)
downloadandroid_packages_apps_Gallery2-ea1a3dad769cd1a48cd04a2df2ebe26e443cb5a1.tar.gz
android_packages_apps_Gallery2-ea1a3dad769cd1a48cd04a2df2ebe26e443cb5a1.tar.bz2
android_packages_apps_Gallery2-ea1a3dad769cd1a48cd04a2df2ebe26e443cb5a1.zip
Gallery2: Fix force close when deletes about 5000 pictures.
According to the log analysis, it's the NullPointerException and ArrayIndexOutOfBoundsException which will cause application crashes. The root cause is multiple thread will call the method getMediaItem in LocalMergeAlbum. To avoid multiple thread mess, add lock to keep safe. CRs-Fixed: 545575 Change-Id: Iaadbb638cfb3f15193f5fcb7d4027ddd5f881201
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/data/LocalMergeAlbum.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/data/LocalMergeAlbum.java b/src/com/android/gallery3d/data/LocalMergeAlbum.java
index f0b5e5726..a5ba4a0e9 100644
--- a/src/com/android/gallery3d/data/LocalMergeAlbum.java
+++ b/src/com/android/gallery3d/data/LocalMergeAlbum.java
@@ -117,7 +117,7 @@ public class LocalMergeAlbum extends MediaSet implements ContentListener {
}
@Override
- public ArrayList<MediaItem> getMediaItem(int start, int count) {
+ public synchronized ArrayList<MediaItem> getMediaItem(int start, int count) {
// First find the nearest mark position <= start.
SortedMap<Integer, int[]> head = mIndex.headMap(start + 1);