mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-09-07 15:07:17 +00:00
GetX-then-SaveX call sites did an unguarded read-modify-write: two concurrent callers could each read the same starting list, mutate different entries, and the second writer's Save clobber the first's update. This is exactly what dropped a preset during #614's rapid-fire preset-programming repro (overlapping PUT .../preset/N requests). Add MutatePresets/MutateRecents/MutateConfiguredSources, each holding a single write lock across the whole read-mutate-write cycle, and switch resolvePresetSource's auto-add-canonical-source path (the same race, for sources) to use the new MutateConfiguredSources. Part of the #614 follow-up; more call sites (UpdatePreset's own preset write, recents, other sources writers) still need converting. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>