Index: trunk/src/org/openstreetmap/josm/Main.java
===================================================================
--- trunk/src/org/openstreetmap/josm/Main.java	(revision 10399)
+++ trunk/src/org/openstreetmap/josm/Main.java	(revision 10400)
@@ -102,4 +102,5 @@
 import org.openstreetmap.josm.gui.progress.ProgressMonitorExecutor;
 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.gui.util.RedirectInputMap;
 import org.openstreetmap.josm.gui.widgets.JMultilineLabel;
@@ -809,5 +810,5 @@
      * the viewport isn't changed
      */
-    public final synchronized void addLayer(final Layer layer, ProjectionBounds bounds) {
+    public final void addLayer(Layer layer, ProjectionBounds bounds) {
         addLayer(layer, bounds == null ? null : new ViewportData(bounds));
     }
@@ -821,5 +822,5 @@
      * @param viewport the viewport to zoom to; can be null, then the viewport isn't changed
      */
-    public final synchronized void addLayer(final Layer layer, ViewportData viewport) {
+    public final void addLayer(Layer layer, ViewportData viewport) {
         getLayerManager().addLayer(layer);
         if (viewport != null) {
@@ -828,5 +829,11 @@
     }
 
+    /**
+     * Creates the map frame. Call only in EDT Thread.
+     * @param firstLayer The first layer that was added.
+     * @param viewportData The initial viewport. Can be <code>null</code> to be automatically computed.
+     */
     public synchronized void createMapFrame(Layer firstLayer, ViewportData viewportData) {
+        GuiHelper.assertCallFromEdt();
         MapFrame mapFrame = new MapFrame(contentPanePrivate, viewportData);
         setMapFrame(mapFrame);
Index: trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java	(revision 10399)
+++ trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java	(revision 10400)
@@ -15,4 +15,5 @@
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;
+import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.io.CertificateAmendment;
 import org.openstreetmap.josm.io.OsmApi;
@@ -115,16 +116,25 @@
 
         if (createGui) {
-            if (Main.toolbar == null) {
-                Main.toolbar = new ToolbarPreferences();
-            }
-            if (Main.main == null) {
-                new MainApplication().initialize();
-            }
-            if (Main.map == null) {
-                Main.main.createMapFrame(null, null);
-            } else {
-                for (Layer l: Main.getLayerManager().getLayers()) {
-                    Main.getLayerManager().removeLayer(l);
+            GuiHelper.runInEDTAndWaitWithException(new Runnable() {
+                @Override
+                public void run() {
+                    setupGUI();
                 }
+            });
+        }
+    }
+
+    private void setupGUI() {
+        if (Main.toolbar == null) {
+            Main.toolbar = new ToolbarPreferences();
+        }
+        if (Main.main == null) {
+            new MainApplication().initialize();
+        }
+        if (Main.map == null) {
+            Main.main.createMapFrame(null, null);
+        } else {
+            for (Layer l: Main.getLayerManager().getLayers()) {
+                Main.getLayerManager().removeLayer(l);
             }
         }
