Ignore:
Timestamp:
2024-09-20T14:06:54+02:00 (5 months ago)
Author:
taylor.smock
Message:

Fix #23930: Merging duplicated layers with little differences stalls JOSM

This is fixed by keeping the "last" conflict in the problem if statement body.

File:
1 edited

Legend:

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

    r19175 r19228  
    141141    protected void addConflict(OsmPrimitive my, OsmPrimitive their) {
    142142        addConflict(new Conflict<>(my, their));
     143    }
     144
     145    private void replaceConflict(Conflict<?> oldConflict, Conflict<?> newConflict) {
     146        newConflict.setMergedMap(mergedMap);
     147        conflicts.remove(oldConflict);
     148        conflicts.add(newConflict);
    143149    }
    144150
     
    326332            // otherwise too many conflicts when refreshing from the server
    327333            // but, if source is modified, there is a conflict
     334            Conflict<?> currentConflict = null;
    328335            if (source.isModified()) {
    329                 addConflict(new Conflict<>(target, source, true));
     336                currentConflict = new Conflict<>(target, source, true);
     337                addConflict(currentConflict);
    330338            }
    331339            // or, if source has a referrer that is not in the target dataset there is a conflict
     
    333341            for (OsmPrimitive referrer: source.getReferrers()) {
    334342                if (targetDataSet.getPrimitiveById(referrer.getPrimitiveId()) == null) {
    335                     addConflict(new Conflict<>(target, source, true));
     343                    final Conflict<?> newConflict = new Conflict<>(target, source, true);
     344                    if (currentConflict != null) { // See #23930
     345                        replaceConflict(currentConflict, newConflict);
     346                    } else {
     347                        addConflict(newConflict);
     348                    }
    336349                    target.setDeleted(false);
    337350                    break;
Note: See TracChangeset for help on using the changeset viewer.