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 ()
1616/* *
1717 * The primary responders added by addPrimaryResponder.
1818 */
19- @property (nonatomic , readonly ) NSMutableArray <id<FlutterKeyPrimaryResponder>>* primaryResponders;
19+ @property (nonatomic , copy , readonly )
20+ NSMutableArray <id<FlutterKeyPrimaryResponder>>* primaryResponders;
2021
2122/* *
2223 * The secondary responders added by addSecondaryResponder.
2324 */
24- @property (nonatomic , readonly )
25+ @property (nonatomic , copy , readonly )
2526 NSMutableArray <id<FlutterKeySecondaryResponder>>* secondaryResponders;
2627
2728- (void )dispatchToSecondaryResponders : (nonnull FlutterUIPressProxy*)press
@@ -49,11 +50,6 @@ - (void)addSecondaryResponder:(nonnull id<FlutterKeySecondaryResponder>)responde
4950 [_secondaryResponders addObject: responder];
5051}
5152
52- - (void )dealloc {
53- [_primaryResponders removeAllObjects ];
54- [_secondaryResponders removeAllObjects ];
55- }
56-
5753- (void )handlePress : (nonnull FlutterUIPressProxy*)press
5854 nextAction : (nonnull void (^)())next API_AVAILABLE(ios(13.4 )) {
5955 if (@available (iOS 13.4 , *)) {
Original file line number Diff line number Diff line change @@ -43,10 +43,16 @@ @implementation FlutterKeyboardManagerTest
4343 OCMStrictProtocolMock (@protocol (FlutterKeyPrimaryResponder));
4444 OCMStub ([mock handlePress: [OCMArg any ] callback: [OCMArg any ]])
4545 .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;
5056 CFRunLoopPerformBlock (CFRunLoopGetCurrent (),
5157 fml::MessageLoopDarwin::kMessageLoopCFRunLoopMode , ^() {
5258 callbackSetter (press, callback);
You can’t perform that action at this time.
0 commit comments