mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-26 20:54:22 +01:00
Fix concurrent access to menuItemsToClickAfterStartup
This commit is contained in:
parent
8a410a8a7f
commit
14e59208b3
@ -1398,7 +1398,7 @@ public class Base {
|
||||
buttonGroupsMap,
|
||||
board, board.getContainerPlatform(), board.getContainerPlatform().getContainerPackage());
|
||||
boardMenu.insert(item, 3);
|
||||
item.setAccelerator(KeyStroke.getKeyStroke('0' + index,
|
||||
item.setAccelerator(KeyStroke.getKeyStroke('1' + index,
|
||||
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() |
|
||||
ActionEvent.SHIFT_MASK));
|
||||
recentBoardsButtonGroup.add(item);
|
||||
@ -1544,18 +1544,14 @@ public class Base {
|
||||
}
|
||||
}
|
||||
|
||||
menuItemsToClickAfterStartup = new LinkedList<>();
|
||||
List<JMenuItem> _menuItemsToClickAfterStartup = new LinkedList<>();
|
||||
boardsButtonGroup = new ButtonGroup();
|
||||
recentBoardsButtonGroup = new ButtonGroup();
|
||||
buttonGroupsMap = new HashMap<>();
|
||||
|
||||
if (BaseNoGui.getRecentlyUsedBoards() != null) {
|
||||
JMenuItem recentLabel = new JMenuItem(tr("Recently used boards"));
|
||||
recentLabel.setEnabled(false);
|
||||
boardMenu.add(recentLabel);
|
||||
rebuildRecentBoardsMenu();
|
||||
//rebuildRecentBoardsMenu(null);
|
||||
}
|
||||
JMenuItem recentLabel = new JMenuItem(tr("Recently used boards"));
|
||||
recentLabel.setEnabled(false);
|
||||
boardMenu.add(recentLabel);
|
||||
|
||||
List<JMenu> platformMenus = new ArrayList<>();
|
||||
|
||||
@ -1577,7 +1573,7 @@ public class Base {
|
||||
for (TargetBoard board : targetPlatform.getBoards().values()) {
|
||||
if (board.getPreferences().get("hide") != null)
|
||||
continue;
|
||||
JMenuItem item = createBoardMenusAndCustomMenus(boardsCustomMenus, menuItemsToClickAfterStartup,
|
||||
JMenuItem item = createBoardMenusAndCustomMenus(boardsCustomMenus, _menuItemsToClickAfterStartup,
|
||||
buttonGroupsMap,
|
||||
board, targetPlatform, targetPackage);
|
||||
platformBoardsMenu.add(item);
|
||||
@ -1612,14 +1608,16 @@ public class Base {
|
||||
|
||||
// If there is no current board yet (first startup, or selected
|
||||
// board no longer defined), select first available board.
|
||||
if (menuItemsToClickAfterStartup.isEmpty()) {
|
||||
menuItemsToClickAfterStartup.add(firstBoardItem);
|
||||
if (_menuItemsToClickAfterStartup.isEmpty()) {
|
||||
_menuItemsToClickAfterStartup.add(selectFirstEnabledMenuItem(boardMenu))
|
||||
}
|
||||
|
||||
for (JMenuItem menuItemToClick : menuItemsToClickAfterStartup) {
|
||||
for (JMenuItem menuItemToClick : _menuItemsToClickAfterStartup) {
|
||||
menuItemToClick.setSelected(true);
|
||||
menuItemToClick.getAction().actionPerformed(new ActionEvent(this, -1, ""));
|
||||
}
|
||||
|
||||
menuItemsToClickAfterStartup = _menuItemsToClickAfterStartup;
|
||||
}
|
||||
|
||||
private String getPlatformUniqueId(TargetPlatform platform) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user