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 @@ -1438,7 +1438,7 @@ public void rebuildRecentBoardsMenu() throws Exception {
1438
1438
boardMenuScroller .setTopFixedCount (3 + index );
1439
1439
}
1440
1440
1441
- public void onBoardOrPortChange () {
1441
+ public synchronized void onBoardOrPortChange () {
1442
1442
BaseNoGui .onBoardOrPortChange ();
1443
1443
1444
1444
// reload keywords when package/platform changes
@@ -1676,7 +1676,20 @@ private JRadioButtonMenuItem createBoardMenusAndCustomMenus(
1676
1676
@ SuppressWarnings ("serial" )
1677
1677
Action action = new AbstractAction (board .getName ()) {
1678
1678
public void actionPerformed (ActionEvent actionevent ) {
1679
- selectTargetBoard ((TargetBoard ) getValue ("b" ));
1679
+ new Thread ()
1680
+ {
1681
+ public void run () {
1682
+ if (activeEditor != null && activeEditor .isUploading ()) {
1683
+ // block until isUploading becomes false, but aboid blocking the UI
1684
+ while (activeEditor .isUploading ()) {
1685
+ try {
1686
+ Thread .sleep (100 );
1687
+ } catch (InterruptedException e ) {}
1688
+ }
1689
+ }
1690
+ selectTargetBoard ((TargetBoard ) getValue ("b" ));
1691
+ }
1692
+ }.start ();
1680
1693
}
1681
1694
};
1682
1695
action .putValue ("b" , board );
You can’t perform that action at this time.
0 commit comments