File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -1423,7 +1423,7 @@ public void rebuildRecentBoardsMenu() throws Exception {
14231423 boardMenuScroller .setTopFixedCount (3 + index );
14241424 }
14251425
1426- public void onBoardOrPortChange () {
1426+ public synchronized void onBoardOrPortChange () {
14271427 BaseNoGui .onBoardOrPortChange ();
14281428
14291429 // reload keywords when package/platform changes
@@ -1633,7 +1633,20 @@ private JRadioButtonMenuItem createBoardMenusAndCustomMenus(
16331633 @ SuppressWarnings ("serial" )
16341634 Action action = new AbstractAction (board .getName ()) {
16351635 public void actionPerformed (ActionEvent actionevent ) {
1636- selectTargetBoard ((TargetBoard ) getValue ("b" ));
1636+ new Thread ()
1637+ {
1638+ public void run () {
1639+ if (activeEditor != null && activeEditor .isUploading ()) {
1640+ // block until isUploading becomes false, but aboid blocking the UI
1641+ while (activeEditor .isUploading ()) {
1642+ try {
1643+ Thread .sleep (100 );
1644+ } catch (InterruptedException e ) {}
1645+ }
1646+ }
1647+ selectTargetBoard ((TargetBoard ) getValue ("b" ));
1648+ }
1649+ }.start ();
16371650 }
16381651 };
16391652 action .putValue ("b" , board );
You can’t perform that action at this time.
0 commit comments