Skip to content

Commit

Permalink
[iOS] Fixes FlutterUIPressProxy leaks (#29156)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongwuzw authored Oct 21, 2021
1 parent b7459d5 commit 731431d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -795,11 +795,12 @@ - (void)pressesBegan:(NSSet<UIPress*>*)presses
withEvent:(UIPressesEvent*)event API_AVAILABLE(ios(9.0)) {
if (@available(iOS 13.4, *)) {
for (UIPress* press in presses) {
[_textInputDelegate handlePressEvent:[[FlutterUIPressProxy alloc] initWithPress:press
withEvent:event]
nextAction:^() {
[super pressesBegan:[NSSet setWithObject:press] withEvent:event];
}];
[_textInputDelegate
handlePressEvent:[[[FlutterUIPressProxy alloc] initWithPress:press
withEvent:event] autorelease]
nextAction:^() {
[super pressesBegan:[NSSet setWithObject:press] withEvent:event];
}];
}
} else {
[super pressesBegan:presses withEvent:event];
Expand All @@ -811,7 +812,8 @@ - (void)pressesChanged:(NSSet<UIPress*>*)presses
if (@available(iOS 13.4, *)) {
for (UIPress* press in presses) {
[_textInputDelegate
handlePressEvent:[[FlutterUIPressProxy alloc] initWithPress:press withEvent:event]
handlePressEvent:[[[FlutterUIPressProxy alloc] initWithPress:press
withEvent:event] autorelease]
nextAction:^() {
[super pressesChanged:[NSSet setWithObject:press] withEvent:event];
}];
Expand All @@ -825,11 +827,12 @@ - (void)pressesEnded:(NSSet<UIPress*>*)presses
withEvent:(UIPressesEvent*)event API_AVAILABLE(ios(9.0)) {
if (@available(iOS 13.4, *)) {
for (UIPress* press in presses) {
[_textInputDelegate handlePressEvent:[[FlutterUIPressProxy alloc] initWithPress:press
withEvent:event]
nextAction:^() {
[super pressesEnded:[NSSet setWithObject:press] withEvent:event];
}];
[_textInputDelegate
handlePressEvent:[[[FlutterUIPressProxy alloc] initWithPress:press
withEvent:event] autorelease]
nextAction:^() {
[super pressesEnded:[NSSet setWithObject:press] withEvent:event];
}];
}
} else {
[super pressesEnded:presses withEvent:event];
Expand All @@ -841,7 +844,8 @@ - (void)pressesCancelled:(NSSet<UIPress*>*)presses
if (@available(iOS 13.4, *)) {
for (UIPress* press in presses) {
[_textInputDelegate
handlePressEvent:[[FlutterUIPressProxy alloc] initWithPress:press withEvent:event]
handlePressEvent:[[[FlutterUIPressProxy alloc] initWithPress:press
withEvent:event] autorelease]
nextAction:^() {
[super pressesCancelled:[NSSet setWithObject:press] withEvent:event];
}];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,8 @@ - (void)pressesBegan:(NSSet<UIPress*>*)presses
withEvent:(UIPressesEvent*)event API_AVAILABLE(ios(9.0)) {
if (@available(iOS 13.4, *)) {
for (UIPress* press in presses) {
[self handlePressEvent:[[FlutterUIPressProxy alloc] initWithPress:press withEvent:event]
[self handlePressEvent:[[[FlutterUIPressProxy alloc] initWithPress:press
withEvent:event] autorelease]
nextAction:^() {
[super pressesBegan:[NSSet setWithObject:press] withEvent:event];
}];
Expand All @@ -1170,7 +1171,8 @@ - (void)pressesChanged:(NSSet<UIPress*>*)presses
withEvent:(UIPressesEvent*)event API_AVAILABLE(ios(9.0)) {
if (@available(iOS 13.4, *)) {
for (UIPress* press in presses) {
[self handlePressEvent:[[FlutterUIPressProxy alloc] initWithPress:press withEvent:event]
[self handlePressEvent:[[[FlutterUIPressProxy alloc] initWithPress:press
withEvent:event] autorelease]
nextAction:^() {
[super pressesChanged:[NSSet setWithObject:press] withEvent:event];
}];
Expand All @@ -1184,7 +1186,8 @@ - (void)pressesEnded:(NSSet<UIPress*>*)presses
withEvent:(UIPressesEvent*)event API_AVAILABLE(ios(9.0)) {
if (@available(iOS 13.4, *)) {
for (UIPress* press in presses) {
[self handlePressEvent:[[FlutterUIPressProxy alloc] initWithPress:press withEvent:event]
[self handlePressEvent:[[[FlutterUIPressProxy alloc] initWithPress:press
withEvent:event] autorelease]
nextAction:^() {
[super pressesEnded:[NSSet setWithObject:press] withEvent:event];
}];
Expand All @@ -1198,7 +1201,8 @@ - (void)pressesCancelled:(NSSet<UIPress*>*)presses
withEvent:(UIPressesEvent*)event API_AVAILABLE(ios(9.0)) {
if (@available(iOS 13.4, *)) {
for (UIPress* press in presses) {
[self handlePressEvent:[[FlutterUIPressProxy alloc] initWithPress:press withEvent:event]
[self handlePressEvent:[[[FlutterUIPressProxy alloc] initWithPress:press
withEvent:event] autorelease]
nextAction:^() {
[super pressesCancelled:[NSSet setWithObject:press] withEvent:event];
}];
Expand Down

0 comments on commit 731431d

Please sign in to comment.