Skip to content

Commit a5ea265

Browse files
committed
Fix concurrent access to menuItemsToClickAfterStartup
1 parent cf4c46b commit a5ea265

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

app/src/processing/app/Base.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ public void rebuildRecentBoardsMenu() throws Exception {
13571357
buttonGroupsMap,
13581358
board, board.getContainerPlatform(), board.getContainerPlatform().getContainerPackage());
13591359
boardMenu.insert(item, 3);
1360-
item.setAccelerator(KeyStroke.getKeyStroke('0' + index,
1360+
item.setAccelerator(KeyStroke.getKeyStroke('1' + index,
13611361
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() |
13621362
ActionEvent.SHIFT_MASK));
13631363
recentBoardsButtonGroup.add(item);
@@ -1503,18 +1503,14 @@ public void actionPerformed(ActionEvent actionevent) {
15031503
boardsCustomMenus.add(customMenu);
15041504
}
15051505

1506-
menuItemsToClickAfterStartup = new LinkedList<>();
1506+
List<JMenuItem> _menuItemsToClickAfterStartup = new LinkedList<>();
15071507
boardsButtonGroup = new ButtonGroup();
15081508
recentBoardsButtonGroup = new ButtonGroup();
15091509
buttonGroupsMap = new HashMap<>();
15101510

1511-
if (BaseNoGui.getRecentlyUsedBoards() != null) {
1512-
JMenuItem recentLabel = new JMenuItem(tr("Recently used boards"));
1513-
recentLabel.setEnabled(false);
1514-
boardMenu.add(recentLabel);
1515-
rebuildRecentBoardsMenu();
1516-
//rebuildRecentBoardsMenu(null);
1517-
}
1511+
JMenuItem recentLabel = new JMenuItem(tr("Recently used boards"));
1512+
recentLabel.setEnabled(false);
1513+
boardMenu.add(recentLabel);
15181514

15191515
// Cycle through all packages
15201516
for (TargetPackage targetPackage : BaseNoGui.packages.values()) {
@@ -1536,7 +1532,7 @@ public void actionPerformed(ActionEvent actionevent) {
15361532
for (TargetBoard board : targetPlatform.getBoards().values()) {
15371533
if (board.getPreferences().get("hide") != null)
15381534
continue;
1539-
JMenuItem item = createBoardMenusAndCustomMenus(boardsCustomMenus, menuItemsToClickAfterStartup,
1535+
JMenuItem item = createBoardMenusAndCustomMenus(boardsCustomMenus, _menuItemsToClickAfterStartup,
15401536
buttonGroupsMap,
15411537
board, targetPlatform, targetPackage);
15421538
boardMenu.add(item);
@@ -1545,14 +1541,16 @@ public void actionPerformed(ActionEvent actionevent) {
15451541
}
15461542
}
15471543

1548-
if (menuItemsToClickAfterStartup.isEmpty()) {
1549-
menuItemsToClickAfterStartup.add(selectFirstEnabledMenuItem(boardMenu));
1544+
if (_menuItemsToClickAfterStartup.isEmpty()) {
1545+
_menuItemsToClickAfterStartup.add(selectFirstEnabledMenuItem(boardMenu));
15501546
}
15511547

1552-
for (JMenuItem menuItemToClick : menuItemsToClickAfterStartup) {
1548+
for (JMenuItem menuItemToClick : _menuItemsToClickAfterStartup) {
15531549
menuItemToClick.setSelected(true);
15541550
menuItemToClick.getAction().actionPerformed(new ActionEvent(this, -1, ""));
15551551
}
1552+
1553+
menuItemsToClickAfterStartup = _menuItemsToClickAfterStartup;
15561554
}
15571555

15581556
private JRadioButtonMenuItem createBoardMenusAndCustomMenus(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy