summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBobby Georgescu <georgescu@google.com>2012-10-24 14:27:04 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-10-24 14:27:04 -0700
commit9b9d03f46cde341c7761b1e7dfd20dcbf8f8b860 (patch)
tree103efa42260a38c216cd51ae349772941553b068
parent90e36d9546a4050c4fbccfae442312037b1d70a7 (diff)
parent68a664431ea1ffdfca53411e8c70ced00bf8dcbc (diff)
downloadandroid_packages_apps_Snap-9b9d03f46cde341c7761b1e7dfd20dcbf8f8b860.tar.gz
android_packages_apps_Snap-9b9d03f46cde341c7761b1e7dfd20dcbf8f8b860.tar.bz2
android_packages_apps_Snap-9b9d03f46cde341c7761b1e7dfd20dcbf8f8b860.zip
am 86282c88: Merge "Fix attempted uploading of recycled tiles" into gb-ub-photos-arches
* commit '86282c8860edfec0df5c28d22d52aa4b59112d55': Fix attempted uploading of recycled tiles
-rw-r--r--src/com/android/gallery3d/ui/TiledTexture.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/com/android/gallery3d/ui/TiledTexture.java b/src/com/android/gallery3d/ui/TiledTexture.java
index 8598a3fff..2c685bd0f 100644
--- a/src/com/android/gallery3d/ui/TiledTexture.java
+++ b/src/com/android/gallery3d/ui/TiledTexture.java
@@ -164,14 +164,19 @@ public class TiledTexture implements Texture {
if (mUploadIndex == mTiles.length) return true;
Tile next = mTiles[mUploadIndex++];
- boolean hasBeenLoad = next.isLoaded();
- next.updateContent(canvas);
-
- // It will take some time for a texture to be drawn for the first
- // time. When scrolling, we need to draw several tiles on the screen
- // at the same time. It may cause a UI jank even these textures has
- // been uploaded.
- if (!hasBeenLoad) next.draw(canvas, 0, 0);
+
+ // Make sure tile has not already been recycled by the time
+ // this is called (race condition in onGLIdle)
+ if (next.bitmap != null) {
+ boolean hasBeenLoad = next.isLoaded();
+ next.updateContent(canvas);
+
+ // It will take some time for a texture to be drawn for the first
+ // time. When scrolling, we need to draw several tiles on the screen
+ // at the same time. It may cause a UI jank even these textures has
+ // been uploaded.
+ if (!hasBeenLoad) next.draw(canvas, 0, 0);
+ }
return mUploadIndex == mTiles.length;
}