diff options
authorValerio Pilo <>2017-05-17 11:15:04 +0200
committerArne Coucheron <>2017-05-29 22:13:35 +0000
commit26d9aecb6f444e2d5d0543b238de78a13fc87558 (patch)
parent48e6c6d48e050255e49110cf49b549c3f2b406f2 (diff)
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
1 files changed, 7 insertions, 0 deletions
diff --git a/src/com/android/camera/data/ b/src/com/android/camera/data/
index c32d6cc..f8b45da 100644
--- a/src/com/android/camera/data/
+++ b/src/com/android/camera/data/
@@ -493,6 +493,13 @@ public abstract class LocalMediaData implements LocalData {
+ // 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;