Hand out hotkey bindings as a snapshot
Hotkeys.all() returned its synchronised list, and every reader had to lock it while iterating: a lock owned by one class and taken by four others. It now returns a copy, and the lock stays inside Hotkeys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -325,10 +325,8 @@ final class VoiceActivationPanel extends FormPanel {
|
||||
dlg.setVisible(true);
|
||||
if (!dlg.isConfirmed()) return;
|
||||
List<Hotkey> updated = new java.util.ArrayList<>();
|
||||
synchronized (hotkeys.all()) {
|
||||
for (Hotkey h : hotkeys.all()) {
|
||||
if (h != existing) updated.add(h.copy());
|
||||
}
|
||||
for (Hotkey h : hotkeys.all()) {
|
||||
if (h != existing) updated.add(h.copy());
|
||||
}
|
||||
updated.add(dlg.result());
|
||||
hotkeys.replaceAll(updated);
|
||||
|
||||
Reference in New Issue
Block a user