Changeset 7983 in josm for trunk/src/org


Ignore:
Timestamp:
2015-01-23T01:21:21+01:00 (9 years ago)
Author:
Don-vip
Message:

fix #10987 - EDT violation during GeoImageLayer merge

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r7954 r7983  
    3737import java.util.concurrent.ExecutorService;
    3838import java.util.concurrent.Executors;
     39import java.util.concurrent.ThreadFactory;
    3940
    4041import javax.swing.Action;
     
    6667import org.openstreetmap.josm.gui.layer.JumpToMarkerActions.JumpToPreviousMarker;
    6768import org.openstreetmap.josm.gui.layer.Layer;
     69import org.openstreetmap.josm.gui.util.GuiHelper;
    6870import org.openstreetmap.josm.tools.ExifReader;
    6971import org.openstreetmap.josm.tools.ImageProvider;
     
    7779import com.drew.metadata.exif.ExifIFD0Directory;
    7880import com.drew.metadata.exif.GpsDirectory;
    79 import java.util.concurrent.ThreadFactory;
    8081
    8182/**
     
    388389        l.stopLoadThumbs();
    389390
    390         ImageEntry selected = null;
    391         if (l.currentPhoto >= 0) {
    392             selected = l.data.get(l.currentPhoto);
    393         }
     391        final ImageEntry selected = l.currentPhoto >= 0 ? l.data.get(l.currentPhoto) : null;
    394392
    395393        data.addAll(l.data);
     
    410408        }
    411409
    412         if (selected != null) {
    413             for (int i = 0; i < data.size() ; i++) {
    414                 if (data.get(i) == selected) {
    415                     currentPhoto = i;
    416                     ImageViewerDialog.showImage(GeoImageLayer.this, data.get(i));
    417                     break;
    418                 }
    419             }
     410        if (selected != null && !data.isEmpty()) {
     411            GuiHelper.runInEDTAndWait(new Runnable() {
     412                @Override
     413                public void run() {
     414                    for (int i = 0; i < data.size() ; i++) {
     415                        if (selected.equals(data.get(i))) {
     416                            currentPhoto = i;
     417                            ImageViewerDialog.showImage(GeoImageLayer.this, data.get(i));
     418                            break;
     419                        }
     420                    }
     421                }
     422            });
    420423        }
    421424
     
    10441047    /**
    10451048     * Stop to load thumbnails.
    1046      * 
     1049     *
    10471050     * Can be called at any time to make sure that the
    10481051     * thumbnail loader is stopped.
     
    10571060    /**
    10581061     * Called to signal that the loading of thumbnails has finished.
    1059      * 
     1062     *
    10601063     * Usually called from {@link ThumbsLoader} in another thread.
    10611064     */
Note: See TracChangeset for help on using the changeset viewer.