From 872e89b772711db068179635d344dbb2cbfa3e9c Mon Sep 17 00:00:00 2001 From: Kevin Date: Sat, 9 Mar 2019 07:55:35 -0800 Subject: [PATCH] Need some more locks for working with calculated yoga layouts (#1388) --- Source/ASDisplayNode+Yoga.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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;