-
Notifications
You must be signed in to change notification settings - Fork 193
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
EXC_BAD_ACCESS in Amplitude.m due to dereferencing nil after refreshing dynamic config #288
Labels
bug
Something isn't working
Comments
jaltreuter
pushed a commit
to jaltreuter/Amplitude-iOS
that referenced
this issue
Oct 5, 2020
…letes if self is now nil (amplitude#288)
jaltreuter
pushed a commit
to jaltreuter/Amplitude-iOS
that referenced
this issue
Oct 5, 2020
…letes if self is now nil (amplitude#288)
jooohhn
pushed a commit
that referenced
this issue
Oct 7, 2020
Abort execution of completion block after dynamic config refresh completes if self is now nil Co-authored-by: Jamie Altreuter <[email protected]>
Merged. Thanks! |
github-actions bot
pushed a commit
that referenced
this issue
Oct 20, 2020
## [7.1.1](v7.1.0...v7.1.1) (2020-10-20) ### Bug Fixes * **buildsettings:** Remove override for GCC_WARN_INHIBIT_ALL_WARNINGS ([#302](#302)) ([0e55297](0e55297)) * **deprecation warnings:** Fix deprecation warnings ([#301](#301)) ([e7b0e6e](e7b0e6e)), closes [/github.com//issues/250#issuecomment-655224554](https://github.com//github.com/amplitude/Amplitude-iOS/issues/250/issues/issuecomment-655224554) * **deprecations:** Use DEPRECATED_MSG_ATTRIBUTE instead of notes ([#305](#305)) ([f501c6c](f501c6c)) * nil dynamic config refresh crash ([#288](#288)) ([#289](#289)) ([9dc896d](9dc896d)) * Swift UserId and DeviceId setter ([#299](#299)) ([b7c0f90](b7c0f90))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behavior
If
Amplitude
is deallocated while dynamic config is being refreshed, the completion block should no-op.Current Behavior
If
Amplitude
is deallocated while dynamic config is being refreshed, the completion block will dereference nil and crash the app.Possible Solution
This is a snippet of the existing code in
Amplitude.m
:The block avoids a retain cycle by creating a weak reference to self, but incorrectly uses that reference. If
weakSelf
becomes nil, the block will then dereference that value and crash. It should be replaced withSteps to Reproduce
Amplitude
useDynamicConfig
to trueinitializeApiKey
Amplitude
Environment
The text was updated successfully, but these errors were encountered: