Changeset 35574 in osm for applications/editors/josm


Ignore:
Timestamp:
2020-10-10T12:12:51+02:00 (4 years ago)
Author:
GerdP
Message:

see #19885: memory leak with "temporary" objects in validator and actions

  • use ChangeNodesCommand instead of ChangeCommand
  • simplify code to copy tags from address node
File:
1 edited

Legend:

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

    r34968 r35574  
    1616import java.util.LinkedList;
    1717import java.util.List;
    18 import java.util.Map.Entry;
    1918import java.util.Set;
    2019
     
    2423import org.openstreetmap.josm.command.AddCommand;
    2524import org.openstreetmap.josm.command.ChangeCommand;
     25import org.openstreetmap.josm.command.ChangeNodesCommand;
    2626import org.openstreetmap.josm.command.Command;
    2727import org.openstreetmap.josm.command.DeleteCommand;
     
    427427            snapToWay(otherNodes, Arrays.asList(nodes));
    428428            if (otherNodes.size() != other.getNodesCount()) {
    429                 Way newWay = new Way(other);
    430                 newWay.setNodes(otherNodes);
    431                 cmds.add(new ChangeCommand(other, newWay));
     429                cmds.add(new ChangeNodesCommand(other, otherNodes));
    432430            }
    433431        }
     
    471469            if (addrNode != null) {
    472470                Collection<Command> addressCmds = cmdList != null ? cmdList : new LinkedList<>();
    473                 for (Entry<String, String> entry : addrNode.getKeys().entrySet()) {
    474                     w.put(entry.getKey(), entry.getValue());
    475                 }
     471                addrNode.getKeys().forEach(w::put);
    476472                for (OsmPrimitive p : addrNode.getReferrers()) {
    477473                    Relation r = (Relation) p;
Note: See TracChangeset for help on using the changeset viewer.