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:
2026-09-25 11:25:25 +00:00
co-authored by Claude Opus 5.5
parent eeccb495eb
commit 5b1809cc2d
5 changed files with 23 additions and 31 deletions
@@ -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);