Ignore:
Timestamp:
2017-05-05T16:27:43+02:00 (3 years ago)
Author:
michael2402
Message:

More ds.beginUpdate()/endUpdate() try/finally fixes, checked all calls of beginUpdate().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r11848 r12065  
    293293                boolean isAtOldPosition = mouseNotMoved && popup != null;
    294294                boolean middleMouseDown = (ms.modifiers & MouseEvent.BUTTON2_DOWN_MASK) != 0;
     295
     296                ds = mv.getLayerManager().getEditDataSet();
     297                if (ds != null) {
     298                    // This is not perfect, if current dataset was changed during execution, the lock would be useless
     299                    if (isAtOldPosition && middleMouseDown) {
     300                        // Write lock is necessary when selecting in popupCycleSelection
     301                        // locks can not be upgraded -> if do read lock here and write lock later
     302                        // (in OsmPrimitive.updateFlags) then always occurs deadlock (#5814)
     303                        ds.beginUpdate();
     304                    } else {
     305                        ds.getReadLock().lock();
     306                    }
     307                }
    295308                try {
    296                     ds = mv.getLayerManager().getEditDataSet();
    297                     if (ds != null) {
    298                         // This is not perfect, if current dataset was changed during execution, the lock would be useless
    299                         if (isAtOldPosition && middleMouseDown) {
    300                             // Write lock is necessary when selecting in popupCycleSelection
    301                             // locks can not be upgraded -> if do read lock here and write lock later
    302                             // (in OsmPrimitive.updateFlags) then always occurs deadlock (#5814)
    303                             ds.beginUpdate();
    304                         } else {
    305                             ds.getReadLock().lock();
    306                         }
    307                     }
    308 
    309309                    // Set the text label in the bottom status bar
    310310                    // "if mouse moved only" was added to stop heap growing
Note: See TracChangeset for help on using the changeset viewer.