Ticket #19789: 19789-v1.patch
File 19789-v1.patch, 3.3 KB (added by , 4 years ago) |
---|
-
src/org/openstreetmap/josm/gui/layer/AutosaveTask.java
316 316 noteLayer.getNoteData().removeNoteDataUpdateListener(this); 317 317 cleanupLayer(noteLayer); 318 318 } 319 } else if (e.getRemovedLayer() instanceof AbstractModifiableLayer) { 320 synchronized (layersLock) { 321 cleanupLayer((AbstractModifiableLayer) e.getRemovedLayer()); 322 } 319 323 } 320 324 } 321 325 -
src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
31 31 import org.openstreetmap.josm.gui.MapView; 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; 36 38 import org.openstreetmap.josm.tools.template_engine.ParseError; … … 73 75 * 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 /** 79 81 * Plugins can add their Marker creation stuff at the bottom or top of this list … … 147 149 private String cachedDefaultTemplate; 148 150 149 151 private CachedLatLon coor; 152 private PreferenceChangedListener listener = l -> updateText(); 150 153 151 154 private boolean erroneous; 152 155 … … 174 177 this.dataProvider = dataProvider; 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 180 183 /** … … 369 372 public void updateText() { 370 373 cachedText = null; 371 374 cachedDefaultTemplate = null; 372 cachedTemplates = new HashMap<>();375 cachedTemplates.clear(); 373 376 } 374 377 375 378 @Override … … 432 435 redSymbol = null; 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 } -
src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
171 171 syncAudioMarker = null; 172 172 currentMarker = null; 173 173 fromLayer = null; 174 data.forEach(Marker::destroy); 174 175 data.clear(); 175 176 super.destroy(); 176 177 }