mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Fixed crash in RCTGenericDelegateSplitter (collection was mutated while being enumerated)
Summary: The concept of the class cannot guarantee that the set of delegates cannot be removed as a side-effect of calling a delegate, so we must make a copy of the delegates before calling on them. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D19213549 fbshipit-source-id: 7040b2994433d83e3148ec73820e051729be9e29
This commit is contained in:
committed by
Facebook Github Bot
parent
a09ab53692
commit
2237ea6d2e
@@ -78,11 +78,17 @@
|
||||
|
||||
- (void)forwardInvocation:(NSInvocation *)invocation
|
||||
{
|
||||
NSMutableArray *targets = [[NSMutableArray alloc] initWithCapacity:_delegates.count];
|
||||
|
||||
for (id delegate in _delegates) {
|
||||
if ([delegate respondsToSelector:[invocation selector]]) {
|
||||
[invocation invokeWithTarget:delegate];
|
||||
[targets addObject:delegate];
|
||||
}
|
||||
}
|
||||
|
||||
for (id target in targets) {
|
||||
[invocation invokeWithTarget:target];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user