Changeset 13419 in josm


Ignore:
Timestamp:
2018-02-12T22:32:19+01:00 (5 days ago)
Author:
Don-vip
Message:

fix #14802 - make sure audio resources are cleared when marker layer is destroyed

Location:
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/AudioMarker.java

    r13281 r13419  
    4141    }
    4242
     43    /**
     44     * Returns the marker played the most recently, if any.
     45     * @return the marker played the most recently, or {@code null}
     46     */
    4347    public static AudioMarker recentlyPlayedMarker() {
    4448        return recentlyPlayedMarker;
     49    }
     50
     51    /**
     52     * Forgets the marker played the most recently, if any.
     53     */
     54    static void resetRecentlyPlayedMarker() {
     55        recentlyPlayedMarker = null;
    4556    }
    4657
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java

    r13206 r13419  
    144144
    145145    @Override
     146    public synchronized void destroy() {
     147        if (data.contains(AudioMarker.recentlyPlayedMarker())) {
     148            AudioMarker.resetRecentlyPlayedMarker();
     149        }
     150        syncAudioMarker = null;
     151        currentMarker = null;
     152        fromLayer = null;
     153        data.clear();
     154        super.destroy();
     155    }
     156
     157    @Override
    146158    public LayerPainter attachToMapView(MapViewEvent event) {
    147159        event.getMapView().addMouseListener(new MarkerMouseAdapter());
Note: See TracChangeset for help on using the changeset viewer.