[iOS] Fixes FlutterUIPressProxy leaks (flutter/engine#29156)

This commit is contained in:
Wu Zhong
2021-10-22 04:14:56 +08:00
committed by GitHub
parent 69b26c89ec
commit b9c37424dc
2 changed files with 24 additions and 16 deletions

View File

@@ -795,11 +795,12 @@ static FlutterAutofillType autofillTypeOf(NSDictionary* configuration) {
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];
@@ -811,7 +812,8 @@ static FlutterAutofillType autofillTypeOf(NSDictionary* configuration) {
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];
}];
@@ -825,11 +827,12 @@ static FlutterAutofillType autofillTypeOf(NSDictionary* configuration) {
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];
@@ -841,7 +844,8 @@ static FlutterAutofillType autofillTypeOf(NSDictionary* configuration) {
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];
}];

View File

@@ -1156,7 +1156,8 @@ static flutter::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* touch)
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];
}];
@@ -1170,7 +1171,8 @@ static flutter::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* touch)
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];
}];
@@ -1184,7 +1186,8 @@ static flutter::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* touch)
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];
}];
@@ -1198,7 +1201,8 @@ static flutter::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* touch)
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];
}];