diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-12-16 18:01:51 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-12-16 18:01:51 -0800 |
commit | 9e809b82a743aa8c2140edb2317080f4cdb0224b (patch) | |
tree | 39b8f6a053ac924ed498df1ba6a150948e3f0d92 | |
parent | 1c0e70afa8bfbe4dd2eedb8196c946702c47f3c5 (diff) | |
download | dsub-9e809b82a743aa8c2140edb2317080f4cdb0224b.tar.gz dsub-9e809b82a743aa8c2140edb2317080f4cdb0224b.tar.bz2 dsub-9e809b82a743aa8c2140edb2317080f4cdb0224b.zip |
Concurrent modification error
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/DownloadService.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java index 7c80ca56..6641d040 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadService.java @@ -2616,7 +2616,7 @@ public class DownloadService extends Service { public void addOnSongChangedListener(OnSongChangedListener listener) { addOnSongChangedListener(listener, false); } - public void addOnSongChangedListener(OnSongChangedListener listener, boolean run) { + public synchronized void addOnSongChangedListener(OnSongChangedListener listener, boolean run) { int index = onSongChangedListeners.indexOf(listener); if(index == -1) { onSongChangedListeners.add(listener); @@ -2637,7 +2637,7 @@ public class DownloadService extends Service { } } } - public void removeOnSongChangeListener(OnSongChangedListener listener) { + public synchronized void removeOnSongChangeListener(OnSongChangedListener listener) { int index = onSongChangedListeners.indexOf(listener); if(index != -1) { onSongChangedListeners.remove(index); @@ -2718,7 +2718,7 @@ public class DownloadService extends Service { } } } - private void onStateUpdate() { + private synchronized void onStateUpdate() { final long atRevision = revision; for(final OnSongChangedListener listener: onSongChangedListeners) { handler.post(new Runnable() { |