Changeset 12195 in josm


Ignore:
Timestamp:
2017-05-16T21:16:42+02:00 (7 days ago)
Author:
michael2402
Message:

Keep a reference to the weak listener, to not let gc remove it.

File:
1 edited

Legend:

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

    r12157 r12195  
    2323import org.openstreetmap.josm.data.gpx.GpxConstants;
    2424import org.openstreetmap.josm.data.gpx.GpxData;
     25import org.openstreetmap.josm.data.gpx.GpxData.GpxDataChangeListener;
    2526import org.openstreetmap.josm.data.gpx.GpxTrack;
    2627import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     
    6061     */
    6162    public boolean[] trackVisibility = new boolean[0];
     63    /**
     64     * Added as field to be kept as reference.
     65     */
     66    private final GpxDataChangeListener dataChangeListener = e -> this.invalidate();
    6267
    6368    /**
     
    8792        super(d.getString(GpxConstants.META_NAME));
    8893        data = d;
    89         data.addWeakChangeListener(e -> this.invalidate());
     94        data.addWeakChangeListener(dataChangeListener);
    9095        trackVisibility = new boolean[data.getTracks().size()];
    9196        Arrays.fill(trackVisibility, true);
Note: See TracChangeset for help on using the changeset viewer.