Changeset 15125 in josm


Ignore:
Timestamp:
2019-05-27T22:03:46+02:00 (5 months ago)
Author:
Don-vip
Message:

fix #17740 - Lock the dataset before we get the selection to avoid disappearing primitives (patch by taylor.smock)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r14928 r15125  
    6868import org.openstreetmap.josm.command.SequenceCommand;
    6969import org.openstreetmap.josm.data.UndoRedoHandler;
     70import org.openstreetmap.josm.data.osm.DataSet;
    7071import org.openstreetmap.josm.data.osm.OsmDataManager;
    7172import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    234235    public void addTag() {
    235236        changedKey = null;
    236         sel = OsmDataManager.getInstance().getInProgressSelection();
    237         if (sel == null || sel.isEmpty())
    238             return;
    239 
    240         final AddTagsDialog addDialog = getAddTagsDialog();
    241 
    242         addDialog.showDialog();
    243 
    244         addDialog.destroyActions();
    245         if (addDialog.getValue() == 1)
    246             addDialog.performTagAdding();
    247         else
    248             addDialog.undoAllTagsAdding();
     237        DataSet activeDataSet = OsmDataManager.getInstance().getActiveDataSet();
     238        try {
     239            activeDataSet.beginUpdate();
     240            sel = OsmDataManager.getInstance().getInProgressSelection();
     241            if (sel == null || sel.isEmpty())
     242                return;
     243
     244            final AddTagsDialog addDialog = getAddTagsDialog();
     245
     246            addDialog.showDialog();
     247
     248            addDialog.destroyActions();
     249            if (addDialog.getValue() == 1)
     250                addDialog.performTagAdding();
     251            else
     252                addDialog.undoAllTagsAdding();
     253        } finally {
     254            activeDataSet.endUpdate();
     255        }
    249256    }
    250257
Note: See TracChangeset for help on using the changeset viewer.