Changeset 12055 in josm


Ignore:
Timestamp:
2017-05-03T20:06:36+02:00 (7 months ago)
Author:
michael2402
Message:

Disable the read lock of the dataset while selection listeners are fired - they might want to write lock it.

File:
1 edited

Legend:

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

    r12049 r12055  
    911911     */
    912912    private boolean doSelectionChange(Function<Set<OsmPrimitive>, SelectionChangeEvent> command) {
    913         lock.readLock().lock();
    914         try {
    915             synchronized (selectionLock) {
    916                 SelectionChangeEvent event = command.apply(currentSelectedPrimitives);
    917                 if (event.isNop()) {
    918                     return false;
    919                 }
    920                 currentSelectedPrimitives = event.getSelection();
    921                 selectionListeners.fireEvent(l -> l.selectionChanged(event));
    922                 return true;
    923             }
    924         } finally {
    925             lock.readLock().unlock();
     913        synchronized (selectionLock) {
     914            SelectionChangeEvent event = command.apply(currentSelectedPrimitives);
     915            if (event.isNop()) {
     916                return false;
     917            }
     918            currentSelectedPrimitives = event.getSelection();
     919            selectionListeners.fireEvent(l -> l.selectionChanged(event));
     920            return true;
    926921        }
    927922    }
Note: See TracChangeset for help on using the changeset viewer.