[iOS] Fix FlutterViewController retain cycle (flutter/engine#43379)

Fixes [flutter/flutter#126560](https://github.com/flutter/flutter/issues/126560)
This commit is contained in:
林洵锋
2023-07-06 01:00:18 +08:00
committed by GitHub
parent 445ea5b7d7
commit 45ac2b64e6
2 changed files with 11 additions and 1 deletions

View File

@@ -2190,7 +2190,7 @@ static BOOL IsSelectionRectBoundaryCloserToPoint(CGPoint point,
NSMutableDictionary<NSString*, FlutterTextInputView*>* autofillContext;
@property(nonatomic, retain) FlutterTextInputView* activeView;
@property(nonatomic, retain) FlutterTextInputViewAccessibilityHider* inputHider;
@property(nonatomic, readonly) id<FlutterViewResponder> viewResponder;
@property(nonatomic, readonly, weak) id<FlutterViewResponder> viewResponder;
@end
@implementation FlutterTextInputPlugin {

View File

@@ -1055,6 +1055,16 @@ extern NSNotificationName const FlutterViewControllerWillDealloc;
OCMVerify([self.mockEngine binaryMessenger]);
}
- (void)testViewControllerIsReleased {
__weak FlutterViewController* weakViewController;
@autoreleasepool {
FlutterViewController* viewController = [[FlutterViewController alloc] init];
weakViewController = viewController;
[viewController viewDidLoad];
}
XCTAssertNil(weakViewController);
}
#pragma mark - Platform Brightness
- (void)testItReportsLightPlatformBrightnessByDefault {