Gallery: fix a memory leak
If video playing is completed, not paused or cancelled, the Runnables
posted are not removed from the Handler. Make sure they are removed.
Change-Id: I4c27583e4305398b35188c494b6da15f809439b9
CRs-Fixed: 999702
diff --git a/src/com/android/gallery3d/app/MoviePlayer.java b/src/com/android/gallery3d/app/MoviePlayer.java
index 720c504..47c9b12 100644
--- a/src/com/android/gallery3d/app/MoviePlayer.java
+++ b/src/com/android/gallery3d/app/MoviePlayer.java
@@ -694,12 +694,14 @@
}
if (mMovieItem.getError()) {
Log.w(TAG, "error occured, exit the video player!");
+ mHandler.removeCallbacksAndMessages(null);
mActivityContext.finish();
return;
}
if (mPlayerExt.getLoop()) {
onReplay();
} else { //original logic
+ mHandler.removeCallbacksAndMessages(null);
mTState = TState.COMPELTED;
if (mCanReplay) {
mController.showEnded();