Index: /trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java	(revision 4742)
+++ /trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java	(revision 4743)
@@ -17,14 +17,11 @@
 import javax.swing.JScrollPane;
 import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
 
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.ShowStatusReportAction;
+import org.openstreetmap.josm.gui.ExtendedDialog;
 import org.openstreetmap.josm.gui.JMultilineLabel;
 import org.openstreetmap.josm.plugins.PluginHandler;
-
-import javax.swing.JPanel;
-import org.openstreetmap.josm.gui.ExtendedDialog;
-import org.openstreetmap.josm.tools.GBC;
-import java.awt.GridBagLayout;
 
 /**
@@ -48,5 +45,5 @@
     }
 
-    public static void handleException(Throwable e) {
+    public static void handleException(final Throwable e) {
         if (handlingInProgress)
             return;                  // we do not handle secondary exceptions, this gets too messy
@@ -66,95 +63,101 @@
                             "Error",
                             JOptionPane.ERROR_MESSAGE
-                    );
+                            );
                     return;
                 }
 
-                // Give the user a chance to deactivate the plugin which threw the exception (if it
-                // was thrown from a plugin)
-                //
-                PluginHandler.disablePluginAfterException(e);
 
-                // Then ask for submitting a bug report, for exceptions thrown from a plugin too
-                //
-                ExtendedDialog ed = new ExtendedDialog(Main.parent, tr("Unexpected Exception"), new String[] {tr("Do nothing"), tr("Report Bug")});
-                ed.setIcon(JOptionPane.ERROR_MESSAGE);
-                JPanel pnl = new JPanel(new GridBagLayout());
-                pnl.add(new JLabel(
-                        "<html>"
-                        + tr("An unexpected exception occurred.<br>" +
-                                "This is always a coding error. If you are running the latest<br>" +
-                                "version of JOSM, please consider being kind and file a bug report."
-                        )
-                        + "</html>"), GBC.eol());
-                JCheckBox cbSuppress = null;
-                if (exceptionCounter > 1) {
-                    cbSuppress = new JCheckBox(tr("Suppress further error dialogs for this session."));
-                    pnl.add(cbSuppress, GBC.eol());
-                }
-                ed.setContent(pnl);
-                ed.showDialog();
-                if (cbSuppress != null && cbSuppress.isSelected()) {
-                    suppressExceptionDialogs = true;
-                }
-                if (ed.getValue() != 2) return;
-                
-                try {
-                    final int maxlen = 6000;
-                    StringWriter stack = new StringWriter();
-                    e.printStackTrace(new PrintWriter(stack));
+                SwingUtilities.invokeLater(new Runnable() {
+                    @Override
+                    public void run() {
+                        // Give the user a chance to deactivate the plugin which threw the exception (if it
+                        // was thrown from a plugin)
+                        //
+                        PluginHandler.disablePluginAfterException(e);
 
-                    String text = ShowStatusReportAction.getReportHeader()
-                    + stack.getBuffer().toString();
-                    String urltext = text.replaceAll("\r",""); /* strip useless return chars */
-                    if(urltext.length() > maxlen)
-                    {
-                        urltext = urltext.substring(0,maxlen);
-                        int idx = urltext.lastIndexOf("\n");
-                        /* cut whole line when not loosing too much */
-                        if(maxlen-idx < 200) {
-                            urltext = urltext.substring(0,idx+1);
+                        // Then ask for submitting a bug report, for exceptions thrown from a plugin too
+                        //
+                        ExtendedDialog ed = new ExtendedDialog(Main.parent, tr("Unexpected Exception"), new String[] {tr("Do nothing"), tr("Report Bug")});
+                        ed.setIcon(JOptionPane.ERROR_MESSAGE);
+                        JPanel pnl = new JPanel(new GridBagLayout());
+                        pnl.add(new JLabel(
+                                "<html>"
+                                        + tr("An unexpected exception occurred.<br>" +
+                                                "This is always a coding error. If you are running the latest<br>" +
+                                                "version of JOSM, please consider being kind and file a bug report."
+                                                )
+                                                + "</html>"), GBC.eol());
+                        JCheckBox cbSuppress = null;
+                        if (exceptionCounter > 1) {
+                            cbSuppress = new JCheckBox(tr("Suppress further error dialogs for this session."));
+                            pnl.add(cbSuppress, GBC.eol());
                         }
-                        urltext += "...<snip>...\n";
-                    }
+                        ed.setContent(pnl);
+                        ed.showDialog();
+                        if (cbSuppress != null && cbSuppress.isSelected()) {
+                            suppressExceptionDialogs = true;
+                        }
+                        if (ed.getValue() != 2) return;
 
-                    URL url = new URL("http://josm.openstreetmap.de/josmticket?" +
-                            "tdata="+Base64.encode(ByteBuffer.wrap(urltext.getBytes("UTF8")), true));
+                        try {
+                            final int maxlen = 6000;
+                            StringWriter stack = new StringWriter();
+                            e.printStackTrace(new PrintWriter(stack));
 
-                    JPanel p = new JPanel(new GridBagLayout());
-                    p.add(new JMultilineLabel(
-                            tr("You have encountered an error in JOSM. Before you file a bug report " +
-                            "make sure you have updated to the latest version of JOSM here:")), GBC.eol());
-                    p.add(new UrlLabel("http://josm.openstreetmap.de/#Download"), GBC.eop().insets(8,0,0,0));
-                    p.add(new JMultilineLabel(
-                            tr("You should also update your plugins. If neither of those help please " +
-                            "file a bug report in our bugtracker using this link:")), GBC.eol());
-                    p.add(new UrlLabel(url.toString(), "http://josm.openstreetmap.de/josmticket?..."), GBC.eop().insets(8,0,0,0));
-                    p.add(new JMultilineLabel(
-                            tr("There the error information provided below should already be " +
-                                    "filled in for you. Please include information on how to reproduce " +
-                            "the error and try to supply as much detail as possible.")), GBC.eop());
-                    p.add(new JMultilineLabel(
-                            tr("Alternatively, if that does not work you can manually fill in the information " +
-                            "below at this URL:")), GBC.eol());
-                    p.add(new UrlLabel("http://josm.openstreetmap.de/newticket"), GBC.eop().insets(8,0,0,0));
-                    if (Utils.copyToClipboard(text)) {
-                        p.add(new JLabel(tr("(The text has already been copied to your clipboard.)")), GBC.eop());
-                    }
+                            String text = ShowStatusReportAction.getReportHeader()
+                                    + stack.getBuffer().toString();
+                            String urltext = text.replaceAll("\r",""); /* strip useless return chars */
+                            if(urltext.length() > maxlen)
+                            {
+                                urltext = urltext.substring(0,maxlen);
+                                int idx = urltext.lastIndexOf("\n");
+                                /* cut whole line when not loosing too much */
+                                if(maxlen-idx < 200) {
+                                    urltext = urltext.substring(0,idx+1);
+                                }
+                                urltext += "...<snip>...\n";
+                            }
 
-                    JTextArea info = new JTextArea(text, 20, 60);
-                    info.setCaretPosition(0);
-                    info.setEditable(false);
-                    p.add(new JScrollPane(info), GBC.eop());
+                            URL url = new URL("http://josm.openstreetmap.de/josmticket?" +
+                                    "tdata="+Base64.encode(ByteBuffer.wrap(urltext.getBytes("UTF8")), true));
 
-                    for (Component c: p.getComponents()) {
-                        if (c instanceof JMultilineLabel) {
-                            ((JMultilineLabel)c).setMaxWidth(400);
+                            JPanel p = new JPanel(new GridBagLayout());
+                            p.add(new JMultilineLabel(
+                                    tr("You have encountered an error in JOSM. Before you file a bug report " +
+                                            "make sure you have updated to the latest version of JOSM here:")), GBC.eol());
+                            p.add(new UrlLabel("http://josm.openstreetmap.de/#Download"), GBC.eop().insets(8,0,0,0));
+                            p.add(new JMultilineLabel(
+                                    tr("You should also update your plugins. If neither of those help please " +
+                                            "file a bug report in our bugtracker using this link:")), GBC.eol());
+                            p.add(new UrlLabel(url.toString(), "http://josm.openstreetmap.de/josmticket?..."), GBC.eop().insets(8,0,0,0));
+                            p.add(new JMultilineLabel(
+                                    tr("There the error information provided below should already be " +
+                                            "filled in for you. Please include information on how to reproduce " +
+                                            "the error and try to supply as much detail as possible.")), GBC.eop());
+                            p.add(new JMultilineLabel(
+                                    tr("Alternatively, if that does not work you can manually fill in the information " +
+                                            "below at this URL:")), GBC.eol());
+                            p.add(new UrlLabel("http://josm.openstreetmap.de/newticket"), GBC.eop().insets(8,0,0,0));
+                            if (Utils.copyToClipboard(text)) {
+                                p.add(new JLabel(tr("(The text has already been copied to your clipboard.)")), GBC.eop());
+                            }
+
+                            JTextArea info = new JTextArea(text, 20, 60);
+                            info.setCaretPosition(0);
+                            info.setEditable(false);
+                            p.add(new JScrollPane(info), GBC.eop());
+
+                            for (Component c: p.getComponents()) {
+                                if (c instanceof JMultilineLabel) {
+                                    ((JMultilineLabel)c).setMaxWidth(400);
+                                }
+                            }
+
+                            JOptionPane.showMessageDialog(Main.parent, p, tr("You have encountered a bug in JOSM"), JOptionPane.ERROR_MESSAGE);
+                        } catch (Exception e1) {
+                            e1.printStackTrace();
                         }
                     }
-
-                    JOptionPane.showMessageDialog(Main.parent, p, tr("You have encountered a bug in JOSM"), JOptionPane.ERROR_MESSAGE);
-                } catch (Exception e1) {
-                    e1.printStackTrace();
-                }
+                });
             }
         } finally {
