kopia lustrzana https://github.com/JOSM/MapWithAI
FIXUP: Avoid a potential deadlock on the EDT
Signed-off-by: Taylor Smock <taylor.smock@kaart.com>pull/1/head
rodzic
106313bc49
commit
267c97200f
|
@ -19,6 +19,8 @@ import java.util.concurrent.ExecutorService;
|
|||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.openstreetmap.josm.data.StructUtils;
|
||||
import org.openstreetmap.josm.data.imagery.ImageryInfo;
|
||||
import org.openstreetmap.josm.data.preferences.BooleanProperty;
|
||||
|
@ -71,6 +73,8 @@ public class MapWithAILayerInfo {
|
|||
if (instance == null) {
|
||||
AtomicBoolean finished = new AtomicBoolean();
|
||||
instance = new MapWithAILayerInfo(() -> finished.set(true));
|
||||
// Avoid a deadlock in the EDT.
|
||||
if (!SwingUtilities.isEventDispatchThread()) {
|
||||
while (!finished.get()) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
|
@ -81,6 +85,7 @@ public class MapWithAILayerInfo {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue