diff options
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r-- | src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java index 278c7e4f..afcea3e5 100644 --- a/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java +++ b/src/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java @@ -238,8 +238,8 @@ public class DownloadServiceLifecycleSupport { } public void onDestroy() { + serializeDownloadQueue(); eventLooper.quit(); - serializeDownloadQueueNow(); downloadService.unregisterReceiver(ejectEventReceiver); downloadService.unregisterReceiver(intentReceiver); @@ -256,12 +256,13 @@ public class DownloadServiceLifecycleSupport { return; } + final List<DownloadFile> songs = new ArrayList<DownloadFile>(downloadService.getSongs()); eventHandler.post(new Runnable() { @Override public void run() { if(lock.tryLock()) { try { - serializeDownloadQueueNow(); + serializeDownloadQueueNow(songs); } finally { lock.unlock(); } @@ -270,8 +271,7 @@ public class DownloadServiceLifecycleSupport { }); } - public void serializeDownloadQueueNow() { - List<DownloadFile> songs = new ArrayList<DownloadFile>(downloadService.getSongs()); + public void serializeDownloadQueueNow(List<DownloadFile> songs) { State state = new State(); for (DownloadFile downloadFile : songs) { state.songs.add(downloadFile.getSong()); |