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);
|
boardMenuScroller.setTopFixedCount(3 + index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onBoardOrPortChange() {
|
public synchronized void onBoardOrPortChange() {
|
||||||
BaseNoGui.onBoardOrPortChange();
|
BaseNoGui.onBoardOrPortChange();
|
||||||
|
|
||||||
// reload keywords when package/platform changes
|
// reload keywords when package/platform changes
|
||||||
@ -1676,7 +1676,20 @@ public class Base {
|
|||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
Action action = new AbstractAction(board.getName()) {
|
Action action = new AbstractAction(board.getName()) {
|
||||||
public void actionPerformed(ActionEvent actionevent) {
|
public void actionPerformed(ActionEvent actionevent) {
|
||||||
selectTargetBoard((TargetBoard) getValue("b"));
|
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);
|
action.putValue("b", board);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user