Skip to content

Commit

Permalink
Fixes oc leaks in platform plugin
Browse files Browse the repository at this point in the history
Some objc objects are not released in the iOS embedder. This fixes a
subset of those leaks in FlutterPlatformPlugin.mm.
  • Loading branch information
zhongwuzw authored and cbracken committed Jan 23, 2020
1 parent 1fc17d1 commit 8203e43
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,16 @@ - (void)vibrateHapticFeedback:(NSString*)feedbackType {

if (@available(iOS 10, *)) {
if ([@"HapticFeedbackType.lightImpact" isEqualToString:feedbackType]) {
[[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight] impactOccurred];
[[[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight] autorelease]
impactOccurred];
} else if ([@"HapticFeedbackType.mediumImpact" isEqualToString:feedbackType]) {
[[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium]
[[[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium] autorelease]
impactOccurred];
} else if ([@"HapticFeedbackType.heavyImpact" isEqualToString:feedbackType]) {
[[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleHeavy] impactOccurred];
[[[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleHeavy] autorelease]
impactOccurred];
} else if ([@"HapticFeedbackType.selectionClick" isEqualToString:feedbackType]) {
[[[UISelectionFeedbackGenerator alloc] init] selectionChanged];
[[[[UISelectionFeedbackGenerator alloc] init] autorelease] selectionChanged];
}
}
}
Expand Down

0 comments on commit 8203e43

Please sign in to comment.