Weird crash in Swift "Object of class _ContiguousArrayStorage deallocated with non-zero retain count 2."
I had some old code which tries to protect its internal state using a DispatchQueue. But it's a struct.
When I access it from multiple threads at the same time via a class, it crashes. In my old Swift 5 code I didn't have the "unchecked Sendable", and I assumed it was correct because of the DispatchQueue.
My actual fix is changing the struct to a final class.
I had some old code which tries to protect its internal state using a DispatchQueue. But it's a struct.
When I access it from multiple threads at the same time via a class, it crashes. In my old Swift 5 code I didn't have the "unchecked Sendable", and I assumed it was correct because of the DispatchQueue.
My actual fix is changing the struct to a final class.



