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 @@ -1422,7 +1422,7 @@ public void rebuildRecentBoardsMenu() throws Exception {
1422
1422
boardMenuScroller .setTopFixedCount (3 + index );
1423
1423
}
1424
1424
1425
- public void onBoardOrPortChange () {
1425
+ public synchronized void onBoardOrPortChange () {
1426
1426
BaseNoGui .onBoardOrPortChange ();
1427
1427
1428
1428
// reload keywords when package/platform changes
@@ -1632,7 +1632,20 @@ private JRadioButtonMenuItem createBoardMenusAndCustomMenus(
1632
1632
@ SuppressWarnings ("serial" )
1633
1633
Action action = new AbstractAction (board .getName ()) {
1634
1634
public void actionPerformed (ActionEvent actionevent ) {
1635
- selectTargetBoard ((TargetBoard ) getValue ("b" ));
1635
+ new Thread ()
1636
+ {
1637
+ public void run () {
1638
+ if (activeEditor != null && activeEditor .isUploading ()) {
1639
+ // block until isUploading becomes false, but aboid blocking the UI
1640
+ while (activeEditor .isUploading ()) {
1641
+ try {
1642
+ Thread .sleep (100 );
1643
+ } catch (InterruptedException e ) {}
1644
+ }
1645
+ }
1646
+ selectTargetBoard ((TargetBoard ) getValue ("b" ));
1647
+ }
1648
+ }.start ();
1636
1649
}
1637
1650
};
1638
1651
action .putValue ("b" , board );
You can’t perform that action at this time.
0 commit comments