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 committed 2026-08-16 14:14:51 -07:00
1 parent 325af3a491
commit 2b7214e3dd
1 file changed
+3 -2
@@ -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