diff options
| author | Owen Lin <owenlin@google.com> | 2012-04-05 12:02:01 +0800 |
|---|---|---|
| committer | Owen Lin <owenlin@google.com> | 2012-04-05 12:04:24 +0800 |
| commit | 71632ac6c1596dd1fd477f95e268f96ad72ea572 (patch) | |
| tree | 5010fa0ba0d970c2d70632ee02e75ef5caaf0b7f /src | |
| parent | 33ef03776b7734717b16f6fc861b831fb1b1dfac (diff) | |
| download | android_packages_apps_Gallery2-71632ac6c1596dd1fd477f95e268f96ad72ea572.tar.gz android_packages_apps_Gallery2-71632ac6c1596dd1fd477f95e268f96ad72ea572.tar.bz2 android_packages_apps_Gallery2-71632ac6c1596dd1fd477f95e268f96ad72ea572.zip | |
Fix NPE in Gallery.
bug: 6249248
Change-Id: I41851c6524163195f6296a15893d962e706b3449
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/gallery3d/app/AlbumPage.java | 21 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/AlbumSetPage.java | 21 |
2 files changed, 28 insertions, 14 deletions
diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index e0b738444..3d8c86d4b 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -45,6 +45,7 @@ import com.android.gallery3d.ui.AlbumView; import com.android.gallery3d.ui.DetailsHelper; import com.android.gallery3d.ui.DetailsHelper.CloseListener; import com.android.gallery3d.ui.GLCanvas; +import com.android.gallery3d.ui.GLRoot; import com.android.gallery3d.ui.GLView; import com.android.gallery3d.ui.GridDrawer; import com.android.gallery3d.ui.HighlightDrawer; @@ -561,13 +562,19 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster ((Activity) mActivity).runOnUiThread(new Runnable() { @Override public void run() { - if (resultCode == MediaSet.SYNC_RESULT_SUCCESS) { - mInitialSynced = true; - } - clearLoadingBit(BIT_LOADING_SYNC); - if (resultCode == MediaSet.SYNC_RESULT_ERROR && mIsActive) { - Toast.makeText((Context) mActivity, R.string.sync_album_error, - Toast.LENGTH_LONG).show(); + GLRoot root = mActivity.getGLRoot(); + root.lockRenderThread(); + try { + if (resultCode == MediaSet.SYNC_RESULT_SUCCESS) { + mInitialSynced = true; + } + clearLoadingBit(BIT_LOADING_SYNC); + if (resultCode == MediaSet.SYNC_RESULT_ERROR && mIsActive) { + Toast.makeText((Context) mActivity, R.string.sync_album_error, + Toast.LENGTH_LONG).show(); + } + } finally { + root.unlockRenderThread(); } } }); diff --git a/src/com/android/gallery3d/app/AlbumSetPage.java b/src/com/android/gallery3d/app/AlbumSetPage.java index 7b8750131..6b4bb00f9 100644 --- a/src/com/android/gallery3d/app/AlbumSetPage.java +++ b/src/com/android/gallery3d/app/AlbumSetPage.java @@ -44,6 +44,7 @@ import com.android.gallery3d.ui.AlbumSetView; import com.android.gallery3d.ui.DetailsHelper; import com.android.gallery3d.ui.DetailsHelper.CloseListener; import com.android.gallery3d.ui.GLCanvas; +import com.android.gallery3d.ui.GLRoot; import com.android.gallery3d.ui.GLView; import com.android.gallery3d.ui.GridDrawer; import com.android.gallery3d.ui.HighlightDrawer; @@ -574,13 +575,19 @@ public class AlbumSetPage extends ActivityState implements ((Activity) mActivity).runOnUiThread(new Runnable() { @Override public void run() { - if (resultCode == MediaSet.SYNC_RESULT_SUCCESS) { - mInitialSynced = true; - } - clearLoadingBit(BIT_LOADING_SYNC); - if (resultCode == MediaSet.SYNC_RESULT_ERROR && mIsActive) { - Toast.makeText((Context) mActivity, R.string.sync_album_set_error, - Toast.LENGTH_LONG).show(); + GLRoot root = mActivity.getGLRoot(); + root.lockRenderThread(); + try { + if (resultCode == MediaSet.SYNC_RESULT_SUCCESS) { + mInitialSynced = true; + } + clearLoadingBit(BIT_LOADING_SYNC); + if (resultCode == MediaSet.SYNC_RESULT_ERROR && mIsActive) { + Toast.makeText((Context) mActivity, R.string.sync_album_set_error, + Toast.LENGTH_LONG).show(); + } + } finally { + root.unlockRenderThread(); } } }); |
