-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
fix(banner, ios): fixed memory leak #565
Conversation
Thanks for the investigation and PR. |
_banner.paidEventHandler = ^(GADAdValue *_Nonnull value) { | ||
[self sendEvent:@"onPaid" | ||
[weakSelf sendEvent:@"onPaid" |
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.
The weak reference should be unwrapped. To avoid crashes if self could have been deallocated by the time the block executes.
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.
__weak typeof(self) weakSelf = self;
_banner.paidEventHandler = ^(GADAdValue *_Nonnull value) {
typeof(self) strongSelf = weakSelf;
if (strongSelf) {
[strongSelf sendEvent:@"onPaid"
payload:@{
@"value" : value.value,
@"precision" : @(value.precision),
@"currency" : value.currencyCode,
}];
}
};
_banner.paidEventHandler = ^(GADAdValue *_Nonnull value) { | ||
[self sendEvent:@"onPaid" | ||
[weakSelf sendEvent:@"onPaid" |
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.
__weak typeof(self) weakSelf = self;
_banner.paidEventHandler = ^(GADAdValue *_Nonnull value) {
typeof(self) strongSelf = weakSelf;
if (strongSelf) {
[strongSelf sendEvent:@"onPaid"
payload:@{
@"value" : value.value,
@"precision" : @(value.precision),
@"currency" : value.currencyCode,
}];
}
};
🎉 This PR is included in version 13.2.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
Related issues
#496
Release Summary
Checklist
and followed the process outlined there for submitting PRs.
Android
iOS
e2e
tests added or updated in__tests__e2e__
jest
tests added or updated in__tests__
Test Plan
Think
react-native-google-mobile-ads
is great? Please consider supporting the project with any of the below:Invertase
on Twitter