From 223721cca8d07bb883c194396bb1149977260e56 Mon Sep 17 00:00:00 2001 From: Bartlomiej Niechwiej Date: Sun, 21 Nov 2010 20:55:44 -0800 Subject: [PATCH] Nullify bineder/checkListener on destroy. --- .../apps/mytracks/services/TrackRecordingService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java b/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java index 784249ed6..56d6b571d 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java +++ b/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java @@ -130,7 +130,7 @@ public class TrackRecordingService extends Service implements LocationListener { * Task invoked by a timer periodically to make sure the location listener is * still registered. */ - private final TimerTask checkLocationListener = new TimerTask() { + private TimerTask checkLocationListener = new TimerTask() { @Override public void run() { // It's always safe to assume that if isRecording() is true, it implies @@ -710,7 +710,9 @@ public class TrackRecordingService extends Service implements LocationListener { showNotification(); prefManager.shutdown(); prefManager = null; + binder = null; checkLocationListener.cancel(); + checkLocationListener = null; timer.cancel(); timer.purge(); unregisterLocationListener(); @@ -898,7 +900,7 @@ public class TrackRecordingService extends Service implements LocationListener { /** * The ITrackRecordingService is defined through IDL. */ - private final ITrackRecordingService.Stub binder = + private ITrackRecordingService.Stub binder = new ITrackRecordingService.Stub() { @Override public boolean isRecording() {