diff options
Diffstat (limited to 'src/com/android/gallery3d/data/MediaSource.java')
-rw-r--r-- | src/com/android/gallery3d/data/MediaSource.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/com/android/gallery3d/data/MediaSource.java b/src/com/android/gallery3d/data/MediaSource.java index 9f7561ec6..95901283b 100644 --- a/src/com/android/gallery3d/data/MediaSource.java +++ b/src/com/android/gallery3d/data/MediaSource.java @@ -77,12 +77,15 @@ public abstract class MediaSource { int n = list.size(); for (int i = 0; i < n; i++) { PathId pid = list.get(i); - MediaObject obj = pid.path.getObject(); - if (obj == null) { - try { - obj = createMediaObject(pid.path); - } catch (Throwable th) { - Log.w(TAG, "cannot create media object: " + pid.path, th); + MediaObject obj; + synchronized (DataManager.LOCK) { + obj = pid.path.getObject(); + if (obj == null) { + try { + obj = createMediaObject(pid.path); + } catch (Throwable th) { + Log.w(TAG, "cannot create media object: " + pid.path, th); + } } } if (obj != null) { |