From 58a07ad777122ad96d18d5eca955b8414387af0b Mon Sep 17 00:00:00 2001 From: max-klaus Date: Fri, 26 Feb 2021 18:01:32 +0300 Subject: [PATCH] Revert "Avoid concurrent modification of location listeners" This reverts commit 8af96a20b59aa270058b5564bf37e2cfc84140fb. --- .../net/osmand/plus/OsmAndLocationProvider.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java b/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java index 1482753b72..760b60599f 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java @@ -373,30 +373,22 @@ public class OsmAndLocationProvider implements SensorEventListener { public void addLocationListener(@NonNull OsmAndLocationListener listener) { if (!locationListeners.contains(listener)) { - List listeners = new ArrayList<>(locationListeners); - listeners.add(listener); - locationListeners = listeners; + locationListeners.add(listener); } } public void removeLocationListener(@NonNull OsmAndLocationListener listener) { - List listeners = new ArrayList<>(locationListeners); - listeners.remove(listener); - locationListeners = listeners; + locationListeners.remove(listener); } public void addCompassListener(@NonNull OsmAndCompassListener listener) { if (!compassListeners.contains(listener)) { - List listeners = new ArrayList<>(compassListeners); - listeners.add(listener); - compassListeners = listeners; + compassListeners.add(listener); } } public void removeCompassListener(@NonNull OsmAndCompassListener listener) { - List listeners = new ArrayList<>(compassListeners); - listeners.remove(listener); - compassListeners = listeners; + compassListeners.remove(listener); } @Nullable