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 @@ -1433,7 +1433,7 @@ public void rebuildRecentBoardsMenu() throws Exception {
1433
1433
boardMenuScroller .setTopFixedCount (3 + index );
1434
1434
}
1435
1435
1436
- public void onBoardOrPortChange () {
1436
+ public synchronized void onBoardOrPortChange () {
1437
1437
BaseNoGui .onBoardOrPortChange ();
1438
1438
1439
1439
// reload keywords when package/platform changes
@@ -1643,7 +1643,20 @@ private JRadioButtonMenuItem createBoardMenusAndCustomMenus(
1643
1643
@ SuppressWarnings ("serial" )
1644
1644
Action action = new AbstractAction (board .getName ()) {
1645
1645
public void actionPerformed (ActionEvent actionevent ) {
1646
- selectTargetBoard ((TargetBoard ) getValue ("b" ));
1646
+ new Thread ()
1647
+ {
1648
+ public void run () {
1649
+ if (activeEditor != null && activeEditor .isUploading ()) {
1650
+ // block until isUploading becomes false, but aboid blocking the UI
1651
+ while (activeEditor .isUploading ()) {
1652
+ try {
1653
+ Thread .sleep (100 );
1654
+ } catch (InterruptedException e ) {}
1655
+ }
1656
+ }
1657
+ selectTargetBoard ((TargetBoard ) getValue ("b" ));
1658
+ }
1659
+ }.start ();
1647
1660
}
1648
1661
};
1649
1662
action .putValue ("b" , board );
You can’t perform that action at this time.
0 commit comments