Changeset 35997 in osm


Ignore:
Timestamp:
2022-07-05T21:36:58+02:00 (2 years ago)
Author:
taylor.smock
Message:

Fix #17465: IAE: Listener buildings_tools.DrawBuildingAction was not registered before or already removed.

This occurs when a user attempts to enter the mapmode when the edit dataset is
null. We fix the problem by (a) updating the layerIsSupported method to use
isEditableDataLayer (introduced in r13434) and (b) removing a check that used
to ensure that if a user entered the mapmode when there was no editable layer,
we immediately exit from the mapmode and enter into the select mode. As all
calls to enterMode should be guarded by layerIsSupported (on layer change),
this is safe now that we are checking if the layer is editable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/buildings_tools/src/org/openstreetmap/josm/plugins/buildings_tools/DrawBuildingAction.java

    r35978 r35997  
    1717import org.openstreetmap.josm.gui.layer.Layer;
    1818import org.openstreetmap.josm.gui.layer.MapViewPaintable;
    19 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2019import org.openstreetmap.josm.gui.util.KeyPressReleaseListener;
    2120import org.openstreetmap.josm.gui.util.ModifierExListener;
     
    3029import java.awt.Color;
    3130import java.awt.Cursor;
    32 import java.awt.EventQueue;
    3331import java.awt.Graphics2D;
    3432import java.awt.Point;
     
    132130
    133131        MapFrame map = MainApplication.getMap();
    134         if (getLayerManager().getEditDataSet() == null) {
    135             map.selectSelectTool(false);
    136             return;
    137         }
    138132        selectedColor = new NamedColorProperty(marktr("selected"), selectedColor).get();
    139133        map.mapView.addMouseListener(this);
     
    440434    @Override
    441435    public boolean layerIsSupported(Layer l) {
    442         return l instanceof OsmDataLayer;
     436        return isEditableDataLayer(l);
    443437    }
    444438
Note: See TracChangeset for help on using the changeset viewer.