Preference synchronization might crash due to preference log entries being a mutable array which can be accessed by several threads at the same time.
The crash happens because the mutable array is changed while being enumerated.
We can mitigate this issue by replacing the array with an immutable one. This does not make the class thread-safe and the code is therefore still incorrect, but at least we won't crash.
In the future we should probably improve our implementation, e.g. by using actors (iOS 15+, though) or nicely crafted reactive pipelines (iOS 13+).
Preference synchronization might crash due to preference log entries being a mutable array which can be accessed by several threads at the same time.
The crash happens because the mutable array is changed while being enumerated.
We can mitigate this issue by replacing the array with an immutable one. This does not make the class thread-safe and the code is therefore still incorrect, but at least we won't crash.
In the future we should probably improve our implementation, e.g. by using actors (iOS 15+, though) or nicely crafted reactive pipelines (iOS 13+).