Ignore:
Timestamp:
2020-10-08T10:37:27+02:00 (4 years ago)
Author:
GerdP
Message:

see #19885: memory leak with "temporary" objects in validator and actions
first bunch of changes

  • use ChangeNodesCommand instead of ChangeCommand
  • call DataSet.clearSelectionHistory() in Dataset.clear()
  • remove fake parent way in AbstractMapRenderer
Location:
trunk/src/org/openstreetmap/josm/data
Files:
3 edited

Legend:

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

    r16553 r17110  
    10961096        update(() -> {
    10971097            clearSelection();
     1098            clearSelectionHistory();
    10981099            for (OsmPrimitive primitive : allPrimitives) {
    10991100                primitive.setDataset(null);
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRenderer.java

    r16553 r17110  
    1313import org.openstreetmap.josm.data.osm.IWay;
    1414import org.openstreetmap.josm.data.osm.OsmData;
     15import org.openstreetmap.josm.data.osm.Way;
    1516import org.openstreetmap.josm.data.osm.WaySegment;
    1617import org.openstreetmap.josm.gui.MapViewState;
     
    149150            for (WaySegment wseg: data.getHighlightedVirtualNodes()) {
    150151                if (wseg.way.isUsable() && !wseg.way.isDisabled()) {
    151                     visitVirtual(path, wseg.toWay());
     152                    Way tmpWay = wseg.toWay();
     153                    visitVirtual(path, tmpWay);
     154                    tmpWay.setNodes(null);
    152155                }
    153156            }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/Coastlines.java

    r14302 r17110  
    1414import java.util.Set;
    1515
    16 import org.openstreetmap.josm.command.ChangeCommand;
     16import org.openstreetmap.josm.command.ChangeNodesCommand;
    1717import org.openstreetmap.josm.command.Command;
    1818import org.openstreetmap.josm.data.osm.Node;
     
    261261            if (it.hasNext()) {
    262262                Way way = (Way) it.next();
    263                 Way newWay = new Way(way);
    264 
    265                 List<Node> nodesCopy = newWay.getNodes();
     263
     264                List<Node> nodesCopy = way.getNodes();
    266265                Collections.reverse(nodesCopy);
    267                 newWay.setNodes(nodesCopy);
    268 
    269                 return new ChangeCommand(way, newWay);
     266
     267                return new ChangeNodesCommand(way, nodesCopy);
    270268            }
    271269        }
Note: See TracChangeset for help on using the changeset viewer.