This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed
shell/platform/darwin/ios/framework/Source Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,13 @@ @interface FlutterKeyboardManager ()
16
16
/* *
17
17
* The primary responders added by addPrimaryResponder.
18
18
*/
19
- @property (nonatomic , readonly ) NSMutableArray <id<FlutterKeyPrimaryResponder>>* primaryResponders;
19
+ @property (nonatomic , copy , readonly )
20
+ NSMutableArray <id<FlutterKeyPrimaryResponder>>* primaryResponders;
20
21
21
22
/* *
22
23
* The secondary responders added by addSecondaryResponder.
23
24
*/
24
- @property (nonatomic , readonly )
25
+ @property (nonatomic , copy , readonly )
25
26
NSMutableArray <id<FlutterKeySecondaryResponder>>* secondaryResponders;
26
27
27
28
- (void )dispatchToSecondaryResponders : (nonnull FlutterUIPressProxy*)press
@@ -49,11 +50,6 @@ - (void)addSecondaryResponder:(nonnull id<FlutterKeySecondaryResponder>)responde
49
50
[_secondaryResponders addObject: responder];
50
51
}
51
52
52
- - (void )dealloc {
53
- [_primaryResponders removeAllObjects ];
54
- [_secondaryResponders removeAllObjects ];
55
- }
56
-
57
53
- (void )handlePress : (nonnull FlutterUIPressProxy*)press
58
54
nextAction : (nonnull void (^)())next API_AVAILABLE(ios(13.4 )) {
59
55
if (@available (iOS 13.4 , *)) {
Original file line number Diff line number Diff line change @@ -43,10 +43,16 @@ @implementation FlutterKeyboardManagerTest
43
43
OCMStrictProtocolMock (@protocol (FlutterKeyPrimaryResponder));
44
44
OCMStub ([mock handlePress: [OCMArg any ] callback: [OCMArg any ]])
45
45
.andDo ((^(NSInvocation * invocation) {
46
- __unsafe_unretained FlutterUIPressProxy* press;
47
- __unsafe_unretained FlutterAsyncKeyCallback callback;
48
- [invocation getArgument: &press atIndex: 2 ];
49
- [invocation getArgument: &callback atIndex: 3 ];
46
+ __unsafe_unretained FlutterUIPressProxy* pressUnsafe;
47
+ __unsafe_unretained FlutterAsyncKeyCallback callbackUnsafe;
48
+
49
+ [invocation getArgument: &pressUnsafe atIndex: 2 ];
50
+ [invocation getArgument: &callbackUnsafe atIndex: 3 ];
51
+
52
+ // Retain the unretained parameters so they can
53
+ // be run in the perform block when this invocation goes out of scope.
54
+ FlutterUIPressProxy* press = pressUnsafe;
55
+ FlutterAsyncKeyCallback callback = callbackUnsafe;
50
56
CFRunLoopPerformBlock (CFRunLoopGetCurrent (),
51
57
fml::MessageLoopDarwin::kMessageLoopCFRunLoopMode , ^() {
52
58
callbackSetter (press, callback);
You can’t perform that action at this time.
0 commit comments