Changeset 12071 in josm


Ignore:
Timestamp:
2017-05-06T15:13:47+02:00 (21 months ago)
Author:
michael2402
Message:

Fix #14736: Make removePrimitve(Primitive) do a full removal including dataset locking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r12069 r12071  
    575575            if (primitive == null)
    576576                return;
    577             clearSelection(primitiveId);
    578             super.removePrimitive(primitive);
    579             allPrimitives.remove(primitive);
    580             primitive.setDataset(null);
     577            removePrimitiveImpl(primitive);
     578            firePrimitivesRemoved(Collections.singletonList(primitive), false);
     579        } finally {
     580            endUpdate();
     581        }
     582    }
     583
     584    private void removePrimitiveImpl(OsmPrimitive primitive) {
     585        clearSelection(primitive.getPrimitiveId());
     586        super.removePrimitive(primitive);
     587        allPrimitives.remove(primitive);
     588        primitive.setDataset(null);
     589    }
     590
     591    @Override
     592    protected void removePrimitive(OsmPrimitive primitive) {
     593        beginUpdate();
     594        try {
     595            removePrimitiveImpl(primitive);
    581596            firePrimitivesRemoved(Collections.singletonList(primitive), false);
    582597        } finally {
     
    12531268                    primitive -> primitive.isDeleted() && (!primitive.isVisible() || primitive.isNew()));
    12541269            if (!toCleanUp.isEmpty()) {
     1270                // We unselect them in advance to not fire a selection change for every primitive
    12551271                clearSelection(toCleanUp.stream().map(OsmPrimitive::getPrimitiveId));
    12561272                for (OsmPrimitive primitive : toCleanUp) {
    1257                     allPrimitives.remove(primitive);
    1258                     removePrimitive(primitive);
    1259                     primitive.setDataset(null);
     1273                    removePrimitiveImpl(primitive);
    12601274                }
    12611275                firePrimitivesRemoved(toCleanUp, false);
Note: See TracChangeset for help on using the changeset viewer.