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