Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ - (void)dealloc {
}

- (UITextField*)textField {
if (_textField == nil) {
_textField = [[[UITextField alloc] init] autorelease];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good god...

if (!_textField) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you get rid of the _textField declaration above too please. It is unnecessary because of the property declaration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean getting rid of

@implementation FlutterSecureTextInputView {
UITextField* _textField;
}
?

I thought this was needed because the property is readonly and I'm overriding its getter, so the ivar is not going to be automatically synthesized?

_textField = [[UITextField alloc] init];
}
return _textField;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ - (void)setTextInputState:(NSDictionary*)state;
- (BOOL)isVisibleToAutofill;
@end

@interface FlutterSecureTextInputView : FlutterTextInputView
@property(nonatomic, strong) UITextField* textField;
@end

@interface FlutterTextInputPlugin ()
@property(nonatomic, strong) FlutterTextInputView* reusableInputView;
@property(nonatomic, assign) FlutterTextInputView* activeView;
Expand Down Expand Up @@ -496,4 +500,15 @@ - (void)testUITextInputCallsUpdateEditingStateOnce {
[inputView unmarkText];
XCTAssertEqual(updateCount, 6);
}

- (void)testNoZombies {
// Regression test for https://github.com/flutter/flutter/issues/62501.
FlutterSecureTextInputView* passwordView = [[FlutterSecureTextInputView alloc] init];

@autoreleasepool {
// Initialize the lazy textField.
[passwordView.textField description];
}
XCTAssert([[passwordView.textField description] containsString:@"TextField"]);
}
@end