@@ -316,7 +316,7 @@ @implementation FlutterKeyCallbackGuard {
316
316
- (nonnull instancetype )initWithCallback : (FlutterAsyncKeyCallback)callback {
317
317
self = [super init ];
318
318
if (self != nil ) {
319
- _callback = callback;
319
+ _callback = [ callback copy ] ;
320
320
_handled = FALSE ;
321
321
}
322
322
return self;
@@ -354,15 +354,15 @@ @interface FlutterEmbedderKeyResponder ()
354
354
*
355
355
* Set by the initializer.
356
356
*/
357
- @property (nonatomic , readonly ) FlutterSendKeyEvent sendEvent;
357
+ @property (nonatomic , copy , readonly ) FlutterSendKeyEvent sendEvent;
358
358
359
359
/* *
360
360
* A map of pressed keys.
361
361
*
362
362
* The keys of the dictionary are physical keys, while the values are the logical keys
363
363
* of the key down event.
364
364
*/
365
- @property (nonatomic , readonly ) NSMutableDictionary <NSNumber*, NSNumber*>* pressingRecords;
365
+ @property (nonatomic , copy , readonly ) NSMutableDictionary <NSNumber*, NSNumber*>* pressingRecords;
366
366
367
367
/* *
368
368
* A constant mask for NSEvent.modifierFlags that Flutter synchronizes with.
@@ -401,7 +401,7 @@ @interface FlutterEmbedderKeyResponder ()
401
401
* Its values are |responseId|s, and keys are the callback that was received
402
402
* along with the event.
403
403
*/
404
- @property (nonatomic , readonly )
404
+ @property (nonatomic , copy , readonly )
405
405
NSMutableDictionary <NSNumber*, FlutterAsyncKeyCallback>* pendingResponses;
406
406
407
407
/* *
@@ -490,7 +490,7 @@ @implementation FlutterEmbedderKeyResponder
490
490
- (nonnull instancetype )initWithSendEvent : (FlutterSendKeyEvent)sendEvent {
491
491
self = [super init ];
492
492
if (self != nil ) {
493
- _sendEvent = sendEvent;
493
+ _sendEvent = [ sendEvent copy ] ;
494
494
_pressingRecords = [[NSMutableDictionary alloc ] init ];
495
495
_pendingResponses = [[NSMutableDictionary alloc ] init ];
496
496
_responseId = 1 ;
0 commit comments