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 @@ -1423,7 +1423,7 @@ public void rebuildRecentBoardsMenu() throws Exception {
1423
1423
boardMenuScroller .setTopFixedCount (3 + index );
1424
1424
}
1425
1425
1426
- public void onBoardOrPortChange () {
1426
+ public synchronized void onBoardOrPortChange () {
1427
1427
BaseNoGui .onBoardOrPortChange ();
1428
1428
1429
1429
// reload keywords when package/platform changes
@@ -1633,7 +1633,20 @@ private JRadioButtonMenuItem createBoardMenusAndCustomMenus(
1633
1633
@ SuppressWarnings ("serial" )
1634
1634
Action action = new AbstractAction (board .getName ()) {
1635
1635
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 ();
1637
1650
}
1638
1651
};
1639
1652
action .putValue ("b" , board );
You can’t perform that action at this time.
0 commit comments