From f205a6cc28e139c16966a7a43a5f59bdd0234002 Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Fri, 25 Mar 2016 22:33:28 -0700 Subject: [PATCH] Copy sublayers in recursivelyTriggerDisplayForLayer to avoid NSFastEnumerationMutation exception --- AsyncDisplayKit/ASDisplayNode.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AsyncDisplayKit/ASDisplayNode.mm b/AsyncDisplayKit/ASDisplayNode.mm index 17797a62af..eedb99fcd2 100644 --- a/AsyncDisplayKit/ASDisplayNode.mm +++ b/AsyncDisplayKit/ASDisplayNode.mm @@ -1797,7 +1797,8 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock) } // Kick off the recursion first, so that all necessary display calls are sent and the displayQueue is full of parallelizable work. - for (CALayer *sublayer in layer.sublayers) { + // NOTE: The docs report that `sublayers` returns a copy but it actually doesn't. + for (CALayer *sublayer in [layer.sublayers copy]) { recursivelyTriggerDisplayForLayer(sublayer, shouldBlock); }