Changeset 13223 in josm


Ignore:
Timestamp:
2017-12-18T15:03:48+01:00 (4 months ago)
Author:
Don-vip
Message:

fix #15008 - make sure EDT listeners receive correct selection events

File:
1 edited

Legend:

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

    r12973 r13223  
    88import java.util.concurrent.CopyOnWriteArrayList;
    99import java.util.stream.Stream;
    10 
    11 import javax.swing.SwingUtilities;
    1210
    1311import org.openstreetmap.josm.data.SelectionChangedListener;
     
    2018import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
    2119import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
     20import org.openstreetmap.josm.gui.util.GuiHelper;
    2221import org.openstreetmap.josm.tools.bugreport.BugReport;
     22import org.openstreetmap.josm.tools.bugreport.ReportedException;
    2323
    2424/**
     
    7272            return Objects.equals(listener, that.listener);
    7373        }
     74
     75        @Override
     76        public String toString() {
     77            return "OldListenerInfo [listener=" + listener + ']';
     78        }
    7479    }
    7580
     
    97102            DataListenerInfo that = (DataListenerInfo) o;
    98103            return Objects.equals(listener, that.listener);
     104        }
     105
     106        @Override
     107        public String toString() {
     108            return "DataListenerInfo [listener=" + listener + ']';
    99109        }
    100110    }
     
    196206    public void selectionChanged(SelectionChangeEvent event) {
    197207        fireEvent(immedatelyListeners, event);
    198         SwingUtilities.invokeLater(() -> fireEvent(inEDTListeners, event));
     208        try {
     209            GuiHelper.runInEDTAndWaitWithException(() -> fireEvent(inEDTListeners, event));
     210        } catch (ReportedException e) {
     211            throw BugReport.intercept(e).put("event", event).put("inEDTListeners", inEDTListeners);
     212        }
    199213    }
    200214
Note: See TracChangeset for help on using the changeset viewer.