Skip to content

Commit 0e4aa6d

Browse files
authored
cast listener with __block so that it can be altered within block (#11461)
1 parent 3f5972f commit 0e4aa6d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

FirebaseRemoteConfig/Sources/RCNConfigRealtime.m

+3-2
Original file line numberDiff line numberDiff line change
@@ -688,16 +688,17 @@ - (FIRConfigUpdateListenerRegistration *)addConfigUpdateListener:
688688
if (listener == nil) {
689689
return nil;
690690
}
691+
__block id listenerCopy = listener;
691692

692693
__weak RCNConfigRealtime *weakSelf = self;
693694
dispatch_async(_realtimeLockQueue, ^{
694695
__strong RCNConfigRealtime *strongSelf = weakSelf;
695-
[strongSelf->_listeners addObject:listener];
696+
[strongSelf->_listeners addObject:listenerCopy];
696697
[strongSelf beginRealtimeStream];
697698
});
698699

699700
return [[FIRConfigUpdateListenerRegistration alloc] initWithClient:self
700-
completionHandler:listener];
701+
completionHandler:listenerCopy];
701702
}
702703

703704
- (void)removeConfigUpdateListener:(void (^_Nonnull)(FIRRemoteConfigUpdate *configUpdate,

0 commit comments

Comments
 (0)