diff --git a/Source/ASDisplayNode+Yoga.mm b/Source/ASDisplayNode+Yoga.mm index 038459fa43..c5bbc68270 100644 --- a/Source/ASDisplayNode+Yoga.mm +++ b/Source/ASDisplayNode+Yoga.mm @@ -286,6 +286,7 @@ - (void)invalidateCalculatedYogaLayout { + ASLockScopeSelf(); YGNodeRef yogaNode = self.style.yogaNode; if (yogaNode && [self shouldHaveYogaMeasureFunc]) { // Yoga internally asserts that MarkDirty() may only be called on nodes with a measurement function. @@ -338,6 +339,7 @@ - (void)calculateLayoutFromYogaRoot:(ASSizeRange)rootConstrainedSize { + ASScopedLockSet lockSet = [self lockToRootIfNeededForLayout]; ASDisplayNode *yogaRoot = self.yogaRoot; if (self != yogaRoot) { @@ -358,7 +360,6 @@ } }]; - // Prepare all children for the layout pass with the current Yoga tree configuration. ASDisplayNodePerformBlockOnEveryYogaChild(self, ^(ASDisplayNode *_Nonnull node) { node.yogaLayoutInProgress = YES;