-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unowned self reference crashed on iOS 13 #2008
Conversation
@mats-claassen when these fixed will be released? I apply them manually and can confirm my app is not crashing anymore. |
when these fixed will be released? please release as soon as possible |
Release is on its way #2011 |
Somehow, this fix was not enough for xcode 11.4 & iOS 13.4 GM. Still experienced a BAD_ADDRESS Added the self. reference in BaseRow and the error disappeared, should I create a PR?
|
@mffryslan Did you experience that in the Examples? Or can you provide code to reproduce it? I tested it on Xcode 11.4 and iOS 13.4 |
Hi! I am not sure if it's the same issue, but getting Here is an example:
The crash occurs on
EDIT: Renaming |
Hey @vinczebalazs I tried your code in the Example project and I am not getting any crash running on the simulator. Did you get that crash in the Example project? Have you done a clean and build? |
@@ -202,7 +202,7 @@ extension RowType where Self: BaseRow { | |||
*/ | |||
@discardableResult | |||
public func onChange(_ callback: @escaping (Self) -> Void) -> Self { | |||
callbackOnChange = { [unowned self] in callback(self) } | |||
callbackOnChange = { [weak self] in callback(self!) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
force unwrawpping a weak self is just as bad as unowned self. My suggestion is test the optional properly.
[weak self] in guard let
self = self else { return }; callback(self)
This code should be equivalent but somehow using unowned crashes the app in iOS 13.
Also when building for release the compiler crashes with a segmentation fault.
Fixes #1987
Fixes #1999
Fixes #1988