chiark / gitweb /
threading fixes: use invokeLater to always run the GUI initialisation on the event...
[jarrg-ian.git] / src / net / chiark / yarrg / MarketUploader.java
index 2e83678314e59cd04b66ea00bb97f70f1c2f207d..eb97225e54ca1eadfffe3bf9535326a4ea5c4b18 100644 (file)
@@ -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();