Changeset 13316 in josm for trunk/src/org
- Timestamp:
- 2018-01-14T00:39:35+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r13249 r13316 9 9 import java.lang.ref.WeakReference; 10 10 import java.net.URL; 11 import java.util.ArrayList;12 11 import java.util.Collection; 13 12 import java.util.Collections; … … 20 19 import java.util.Set; 21 20 import java.util.concurrent.Callable; 21 import java.util.concurrent.CopyOnWriteArrayList; 22 22 import java.util.concurrent.ExecutionException; 23 23 import java.util.concurrent.ExecutorService; … … 410 410 * created dataset as projection change listener. 411 411 */ 412 private static final List<WeakReference<ProjectionChangeListener>> listeners = new ArrayList<>();412 private static final List<WeakReference<ProjectionChangeListener>> listeners = new CopyOnWriteArrayList<>(); 413 413 414 414 private static void fireProjectionChanged(Projection oldValue, Projection newValue, Bounds oldBounds) { 415 415 if ((newValue == null ^ oldValue == null) 416 416 || (newValue != null && oldValue != null && !Objects.equals(newValue.toCode(), oldValue.toCode()))) { 417 synchronized (Main.class) { 418 Iterator<WeakReference<ProjectionChangeListener>> it = listeners.iterator(); 419 while (it.hasNext()) { 420 WeakReference<ProjectionChangeListener> wr = it.next(); 421 ProjectionChangeListener listener = wr.get(); 422 if (listener == null) { 423 it.remove(); 424 continue; 425 } 426 listener.projectionChanged(oldValue, newValue); 417 Iterator<WeakReference<ProjectionChangeListener>> it = listeners.iterator(); 418 while (it.hasNext()) { 419 WeakReference<ProjectionChangeListener> wr = it.next(); 420 ProjectionChangeListener listener = wr.get(); 421 if (listener == null) { 422 it.remove(); 423 continue; 427 424 } 425 listener.projectionChanged(oldValue, newValue); 428 426 } 429 427 if (newValue != null && oldBounds != null && main != null) {
Note:
See TracChangeset
for help on using the changeset viewer.