From: Ian Jackson Date: Sat, 2 Apr 2011 12:14:49 +0000 (+0100) Subject: threading fixes: use invokeLater to always run the GUI initialisation on the event... X-Git-Tag: 1.0.5~15 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=commitdiff_plain;h=34938af153ce24d7f700345f518d10f767608a24;p=jarrg-ian.git threading fixes: use invokeLater to always run the GUI initialisation on the event thread --- diff --git a/src/net/chiark/yarrg/MarketUploader.java b/src/net/chiark/yarrg/MarketUploader.java index 2e83678..eb97225 100644 --- a/src/net/chiark/yarrg/MarketUploader.java +++ b/src/net/chiark/yarrg/MarketUploader.java @@ -34,7 +34,7 @@ import java.beans.*; * an error dialog is shown, and processing returns, the button * becoming re-enabled. */ -public class MarketUploader implements TopLevelWindowListener, GUIInitializedListener { +public class MarketUploader implements Runnable, TopLevelWindowListener, GUIInitializedListener { private JFrame frame = null; private Window window = null; private JButton findMarket = null; @@ -272,6 +272,12 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis uploadToPCTB=prefs.getBoolean("uploadToPCTB", true); showArbitrage=prefs.getBoolean("showArbitrage", true); + if (dtxt!=null) dtxt.println("main on dispatch thread: "+EventQueue.isDispatchThread()); + EventQueue.invokeLater(this); + } + + public void run() { + if (dtxt!=null) dtxt.println("MarketUploader run()..."); EventQueueMonitor.addTopLevelWindowListener(this); if (EventQueueMonitor.isGUIInitialized()) { createGUI();