Changeset 17047 in josm
- Timestamp:
- 2020-09-20T10:43:08+02:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/layer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/AutosaveTask.java
r16643 r17047 316 316 noteLayer.getNoteData().removeNoteDataUpdateListener(this); 317 317 cleanupLayer(noteLayer); 318 } 319 } else if (e.getRemovedLayer() instanceof AbstractModifiableLayer) { 320 synchronized (layersLock) { 321 cleanupLayer((AbstractModifiableLayer) e.getRemovedLayer()); 318 322 } 319 323 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
r16879 r17047 32 32 import org.openstreetmap.josm.gui.layer.GpxLayer; 33 33 import org.openstreetmap.josm.gui.preferences.display.GPXSettingsPanel; 34 import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener; 35 import org.openstreetmap.josm.tools.Destroyable; 34 36 import org.openstreetmap.josm.tools.ImageProvider; 35 37 import org.openstreetmap.josm.tools.Logging; … … 74 76 * @author Frederik Ramm 75 77 */ 76 public class Marker implements TemplateEngineDataProvider, ILatLon {78 public class Marker implements TemplateEngineDataProvider, ILatLon, Destroyable { 77 79 78 80 /** … … 148 150 149 151 private CachedLatLon coor; 152 private PreferenceChangedListener listener = l -> updateText(); 150 153 151 154 private boolean erroneous; … … 175 178 this.text = text; 176 179 177 Preferences.main().addKeyPreferenceChangeListener( "draw.rawgps." + getTextTemplateKey(), l -> updateText());180 Preferences.main().addKeyPreferenceChangeListener(getPreferenceKey(), listener); 178 181 } 179 182 … … 370 373 cachedText = null; 371 374 cachedDefaultTemplate = null; 372 cachedTemplates = new HashMap<>();375 cachedTemplates.clear(); 373 376 } 374 377 … … 433 436 } 434 437 } 438 439 @Override 440 public void destroy() { 441 cachedTemplates.clear(); 442 Preferences.main().removeKeyPreferenceChangeListener(getPreferenceKey(), listener); 443 } 444 445 private String getPreferenceKey() { 446 return "draw.rawgps." + getTextTemplateKey(); 447 } 435 448 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r16967 r17047 172 172 currentMarker = null; 173 173 fromLayer = null; 174 data.forEach(Marker::destroy); 174 175 data.clear(); 175 176 super.destroy();
Note:
See TracChangeset
for help on using the changeset viewer.