Skip to content

Commit 8a5f080

Browse files
committed
Merge pull request facebookarchive#1026 from 1nput0utput/ASControlNodeMutationCrash
[ASControlNode] Copy event table before calling action methods, as they may trigger action removal.
2 parents 005408b + 688e8d2 commit 8a5f080

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

AsyncDisplayKit/ASControlNode.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ - (void)sendActionsForControlEvents:(ASControlNodeEvent)controlEvents withEvent:
339339
_ASEnumerateControlEventsIncludedInMaskWithBlock(controlEvents, ^
340340
(ASControlNodeEvent controlEvent)
341341
{
342-
NSMapTable *eventDispatchTable = [_controlEventDispatchTable objectForKey:_ASControlNodeEventKeyForControlEvent(controlEvent)];
342+
// Use a copy to itereate, the action perform could call remove causing a mutation crash.
343+
NSMapTable *eventDispatchTable = [[_controlEventDispatchTable objectForKey:_ASControlNodeEventKeyForControlEvent(controlEvent)] copy];
343344

344345
// For each target interested in this event...
345346
for (id target in eventDispatchTable)

0 commit comments

Comments
 (0)