diff options
| author | Bobby Georgescu <georgescu@google.com> | 2012-10-24 14:15:38 -0700 |
|---|---|---|
| committer | Bobby Georgescu <georgescu@google.com> | 2012-10-24 14:15:38 -0700 |
| commit | d54825d1cad2ab586b6d32853acc09dc6df5945f (patch) | |
| tree | bd9bd6c81775de51362770a1cfc45d42acd1ab2d /src | |
| parent | eb6a24e13ab8bc6f2a70bf5e8cc70f469809acb9 (diff) | |
| download | android_packages_apps_Gallery2-d54825d1cad2ab586b6d32853acc09dc6df5945f.tar.gz android_packages_apps_Gallery2-d54825d1cad2ab586b6d32853acc09dc6df5945f.tar.bz2 android_packages_apps_Gallery2-d54825d1cad2ab586b6d32853acc09dc6df5945f.zip | |
Fix attempted uploading of recycled tiles
Bug: 7405398
Change-Id: I17711f9c724af216aa22cee6a86d9feba84c1548
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/gallery3d/ui/TiledTexture.java | 21 |
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; } |
