Attempted to read an unowned reference but object ... was already deallocated
Open
- Dominant language
- Swift
- Stars
- 1.4k
- Forks
- 193
- PR merge metrics
- No merged PRs in 30d
Description
I've got a crash when was trying to write data to UDP socket:
`try socket.write(from: data, to: senderAddress)`.
Error occurred at: Socket.swift - line 3211.
You are using `unowned self` which results with "Attempted to read an unowned reference but object ... was already deallocated" error if socket object is deallocated before `write` completes.
Possible solution would be to use `[weak self].`
Contributor guide
Assessment
This issue has not been assessed yet.