summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTom Hennen <tom.hennen@gmail.com>2015-07-28 17:26:02 -0400
committerTom Hennen <tom.hennen@gmail.com>2015-07-28 17:26:02 -0400
commitd45b7c7b6d66b448366538ad67de31a644f49d16 (patch)
tree96172da8d1219c0ad73c5672fbd915a966a19de1 /core
parentd1ef7f63ff3e66f95c510939717aa935cadb2f7b (diff)
downloadAntennaPod-d45b7c7b6d66b448366538ad67de31a644f49d16.zip
* fix ConcurrentModificationException in Gpodder
* removed 'About' tests (they take too long)
Diffstat (limited to 'core')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java
index c3c6ce8c5..1401d5f39 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java
@@ -8,7 +8,6 @@ import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -217,26 +216,36 @@ public class GpodnetPreferences {
public static void removeRemovedFeeds(Collection<String> removed) {
ensurePreferencesLoaded();
+ feedListLock.lock();
removedFeeds.removeAll(removed);
writePreference(PREF_SYNC_REMOVED, removedFeeds);
+ feedListLock.unlock();
}
- public static synchronized void enqueueEpisodeAction(GpodnetEpisodeAction action) {
+ public static void enqueueEpisodeAction(GpodnetEpisodeAction action) {
ensurePreferencesLoaded();
+ feedListLock.lock();
queuedEpisodeActions.add(action);
writePreference(PREF_SYNC_EPISODE_ACTIONS, writeEpisodeActionsToString(queuedEpisodeActions));
+ feedListLock.unlock();
GpodnetSyncService.sendSyncActionsIntent(ClientConfig.applicationCallbacks.getApplicationInstance());
}
public static List<GpodnetEpisodeAction> getQueuedEpisodeActions() {
ensurePreferencesLoaded();
- return Collections.unmodifiableList(queuedEpisodeActions);
+ List<GpodnetEpisodeAction> copy = new ArrayList();
+ feedListLock.lock();
+ copy.addAll(queuedEpisodeActions);
+ feedListLock.unlock();
+ return copy;
}
- public static synchronized void removeQueuedEpisodeActions(Collection<GpodnetEpisodeAction> queued) {
+ public static void removeQueuedEpisodeActions(Collection<GpodnetEpisodeAction> queued) {
ensurePreferencesLoaded();
+ feedListLock.lock();
queuedEpisodeActions.removeAll(queued);
writePreference(PREF_SYNC_EPISODE_ACTIONS, writeEpisodeActionsToString(queuedEpisodeActions));
+ feedListLock.unlock();
}
/**
@@ -252,12 +261,14 @@ public class GpodnetPreferences {
setUsername(null);
setPassword(null);
setDeviceID(null);
+ feedListLock.lock();
addedFeeds.clear();
writePreference(PREF_SYNC_ADDED, addedFeeds);
removedFeeds.clear();
writePreference(PREF_SYNC_REMOVED, removedFeeds);
queuedEpisodeActions.clear();
writePreference(PREF_SYNC_EPISODE_ACTIONS, writeEpisodeActionsToString(queuedEpisodeActions));
+ feedListLock.unlock();
setLastSubscriptionSyncTimestamp(0);
}