mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-26 20:54:22 +01:00
Avoid board change during compilation/upload
By threading the boardChange callback we can busy wait until the compilation/upload phase has ended and change the board when done. Fixes #6035
This commit is contained in:
parent
70d5537fb0
commit
97fd81ac0c
@ -1438,7 +1438,7 @@ public class Base {
|
||||
boardMenuScroller.setTopFixedCount(3 + index);
|
||||
}
|
||||
|
||||
public void onBoardOrPortChange() {
|
||||
public synchronized void onBoardOrPortChange() {
|
||||
BaseNoGui.onBoardOrPortChange();
|
||||
|
||||
// reload keywords when package/platform changes
|
||||
@ -1676,8 +1676,21 @@ public class Base {
|
||||
@SuppressWarnings("serial")
|
||||
Action action = new AbstractAction(board.getName()) {
|
||||
public void actionPerformed(ActionEvent actionevent) {
|
||||
new Thread()
|
||||
{
|
||||
public void run() {
|
||||
if (activeEditor != null && activeEditor.isUploading()) {
|
||||
// block until isUploading becomes false, but aboid blocking the UI
|
||||
while (activeEditor.isUploading()) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {}
|
||||
}
|
||||
}
|
||||
selectTargetBoard((TargetBoard) getValue("b"));
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
};
|
||||
action.putValue("b", board);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user