Ignore:
Timestamp:
2020-10-11T14:24:00+02:00 (4 years ago)
Author:
GerdP
Message:

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

  • use ChangeNodesCommand instead of ChangeCommand
  • use ChangePropertyCommand instead of ChangeCommand
  • remove unused parameter

Just a small step forward...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/SplitWayCommand.java

    r16781 r17163  
    351351
    352352        // Figure out the order of relation members (if any).
    353         Analysis analysis = analyseSplit(way, wayToKeep, newWays, indexOfWayToKeep);
     353        Analysis analysis = analyseSplit(way, wayToKeep, newWays);
    354354
    355355        // If there are relations that cannot be split properly without downloading more members,
     
    406406                // If missing relation members were downloaded, perform the analysis again to find the relation
    407407                // member order for all relations.
    408                 analysis = analyseSplit(way, wayToKeep, newWays, indexOfWayToKeep);
     408                analysis = analyseSplit(way, wayToKeep, newWays);
    409409                return Optional.of(splitBasedOnAnalyses(way, newWays, newSelection, analysis, indexOfWayToKeep));
    410410            case GO_AHEAD_WITHOUT_DOWNLOADS:
     
    421421    static Analysis analyseSplit(Way way,
    422422                                 Way wayToKeep,
    423                                  List<Way> newWays,
    424                                  int indexOfWayToKeep) {
     423                                 List<Way> newWays) {
    425424        Collection<Command> commandList = new ArrayList<>();
    426425        Collection<String> nowarnroles = Config.getPref().getList("way.split.roles.nowarn",
     
    430429        final Way changedWay = new Way(way);
    431430        changedWay.setNodes(wayToKeep.getNodes());
    432         commandList.add(new ChangeCommand(way, changedWay));
    433 
     431        commandList.add(new ChangeNodesCommand(way, changedWay.getNodes()));
    434432        for (Way wayToAdd : newWays) {
    435433            commandList.add(new AddCommand(way.getDataSet(), wayToAdd));
     
    559557            }
    560558        }
    561 
     559        changedWay.setNodes(null); // see #19885
    562560        return new Analysis(relationAnalyses, commandList, warnings, numberOfRelations);
    563561    }
Note: See TracChangeset for help on using the changeset viewer.