From 283a53e4db0707f12b96888727ad5ffe3cc908f7 Mon Sep 17 00:00:00 2001 From: Christopher Eby Date: Fri, 2 Sep 2011 00:41:17 -0500 Subject: [PATCH] Fix PlaybackService.onDestroy Pausing in onDestroy was broadcasting an update which would cause receivers to restart the service and/or crash. --- src/org/kreed/vanilla/PlaybackService.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/org/kreed/vanilla/PlaybackService.java b/src/org/kreed/vanilla/PlaybackService.java index a49749ba..609b5c30 100644 --- a/src/org/kreed/vanilla/PlaybackService.java +++ b/src/org/kreed/vanilla/PlaybackService.java @@ -283,18 +283,17 @@ public final class PlaybackService extends Service implements Handler.Callback, { ContextApplication.setService(null); - super.onDestroy(); + mLooper.quit(); + + // clear the notification + stopForegroundCompat(true); if (mMediaPlayer != null) { mTimeline.saveState(this, mMediaPlayer.getCurrentPosition()); - - unsetFlag(FLAG_PLAYING); mMediaPlayer.release(); mMediaPlayer = null; } - mLooper.quit(); - MediaButtonHandler.unregisterMediaButton(); try { @@ -305,6 +304,8 @@ public final class PlaybackService extends Service implements Handler.Callback, if (mWakeLock != null && mWakeLock.isHeld()) mWakeLock.release(); + + super.onDestroy(); } public void startForegroundCompat(int id, Notification notification)