summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValerio Pilo <vpilo@coldshock.net>2017-05-17 11:15:04 +0200
committerArne Coucheron <arco68@gmail.com>2017-05-29 22:13:35 +0000
commit26d9aecb6f444e2d5d0543b238de78a13fc87558 (patch)
tree30ded051c30e987dcaf8a4d0746c1cb7f999fc93
parent48e6c6d48e050255e49110cf49b549c3f2b406f2 (diff)
downloadandroid_packages_apps_Snap-26d9aecb6f444e2d5d0543b238de78a13fc87558.tar.gz
android_packages_apps_Snap-26d9aecb6f444e2d5d0543b238de78a13fc87558.tar.bz2
android_packages_apps_Snap-26d9aecb6f444e2d5d0543b238de78a13fc87558.zip
Fixed camera crash on exit
This is just a copy of a fix already done long time ago (commit c3d5c2c5) only for videos, now also for photos. Original description follows: CameraNext: don't call Glide to load image after Camera exits There is a race condition where the filmstrip can still be trying to load a new image just as the camera exit, and Glide gets upset if it is handed a destroyed activity context to work with. So just check for that condition and go home. Change-Id: If7f2b2e4d23189d3c6876d47d5f2046d9e02c7b0
-rw-r--r--src/com/android/camera/data/LocalMediaData.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/com/android/camera/data/LocalMediaData.java b/src/com/android/camera/data/LocalMediaData.java
index c32d6ccf9..f8b45da47 100644
--- a/src/com/android/camera/data/LocalMediaData.java
+++ b/src/com/android/camera/data/LocalMediaData.java
@@ -493,6 +493,13 @@ public abstract class LocalMediaData implements LocalData {
return;
}
+ // band-aid over a race condition where the filmstrip is in the process
+ // of refreshing because of new media just as the camera exits
+ if ((context instanceof Activity) && ((Activity)context).isDestroyed()) {
+ Log.d(TAG, "aborted loadImage because context was destroyed");
+ return;
+ }
+
final int overrideWidth;
final int overrideHeight;
final BitmapRequestBuilder<Uri, Bitmap> thumbnailRequest;