Take a copy of the active books before applying the speed limit

Same unlocked-enumeration problem as the others: the speed limit is
changed from the UI thread while book tasks are starting and finishing,
and Active is the live list.
This commit is contained in:
Allamagoosa
2026-08-16 14:13:57 -07:00
parent 325af3a491
commit 2b7214e3dd

View File

@@ -102,8 +102,9 @@ public class ProcessQueueViewModel : ReactiveObject
: 0;
config.DownloadSpeedLimit = (long)(_speedLimit * 1024 * 1024);
// Apply to all currently active books
foreach (var activeBook in Queue.Active.OfType<ProcessBookViewModel>())
// Apply to all currently active books. Over a copy: the speed limit is changed from the UI
// thread while book tasks start and finish, and Active is the live list.
foreach (var activeBook in Queue.GetActive().OfType<ProcessBookViewModel>())
activeBook.Configuration.DownloadSpeedLimit = config.DownloadSpeedLimit;
SpeedLimitIncrement = _speedLimit > 100 ? 10