Ignore:
Timestamp:
2017-05-11T10:57:14+02:00 (3 years ago)
Author:
michael2402
Message:

Fix weak projection listener of NavigatableComponent being lost.

File:
1 edited

Legend:

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

    r12074 r12119  
    5252import org.openstreetmap.josm.data.preferences.IntegerProperty;
    5353import org.openstreetmap.josm.data.projection.Projection;
     54import org.openstreetmap.josm.data.projection.ProjectionChangeListener;
    5455import org.openstreetmap.josm.data.projection.Projections;
    5556import org.openstreetmap.josm.gui.help.Helpful;
     
    171172
    172173    /**
     174     * Main uses weak link to store this, so we need to keep a reference.
     175     */
     176    private final ProjectionChangeListener projectionChangeListener = (oldValue, newValue) -> fixProjection();
     177
     178    /**
    173179     * Constructs a new {@code NavigatableComponent}.
    174180     */
     
    176182        setLayout(null);
    177183        state = MapViewState.createDefaultState(getWidth(), getHeight());
    178         // uses weak link.
    179         Main.addProjectionChangeListener((oldValue, newValue) -> fixProjection());
     184        Main.addProjectionChangeListener(projectionChangeListener);
    180185    }
    181186
Note: See TracChangeset for help on using the changeset viewer.