Merge pull request #1026 from 1nput0utput/ASControlNodeMutationCrash

[ASControlNode] Copy event table before calling action methods, as they may trigger action removal.
This commit is contained in:
appleguy
2016-01-03 20:18:30 -08:00

View File

@@ -339,7 +339,8 @@ void _ASEnumerateControlEventsIncludedInMaskWithBlock(ASControlNodeEvent mask, v
_ASEnumerateControlEventsIncludedInMaskWithBlock(controlEvents, ^
(ASControlNodeEvent controlEvent)
{
NSMapTable *eventDispatchTable = [_controlEventDispatchTable objectForKey:_ASControlNodeEventKeyForControlEvent(controlEvent)];
// Use a copy to itereate, the action perform could call remove causing a mutation crash.
NSMapTable *eventDispatchTable = [[_controlEventDispatchTable objectForKey:_ASControlNodeEventKeyForControlEvent(controlEvent)] copy];
// For each target interested in this event...
for (id target in eventDispatchTable)