Skip to content

Commit

Permalink
Need some more locks for working with calculated yoga layouts (Textur…
Browse files Browse the repository at this point in the history
  • Loading branch information
wiseoldduck authored and hebertialmeida committed May 10, 2019
1 parent 932289f commit b20e007
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/ASDisplayNode+Yoga.mm
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ - (void)updateYogaMeasureFuncIfNeeded

- (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.
Expand Down Expand Up @@ -338,6 +339,7 @@ - (ASLayout *)calculateLayoutYoga:(ASSizeRange)constrainedSize

- (void)calculateLayoutFromYogaRoot:(ASSizeRange)rootConstrainedSize
{
ASScopedLockSet lockSet = [self lockToRootIfNeededForLayout];
ASDisplayNode *yogaRoot = self.yogaRoot;

if (self != yogaRoot) {
Expand All @@ -358,7 +360,6 @@ - (void)calculateLayoutFromYogaRoot:(ASSizeRange)rootConstrainedSize
}
}];


// Prepare all children for the layout pass with the current Yoga tree configuration.
ASDisplayNodePerformBlockOnEveryYogaChild(self, ^(ASDisplayNode *_Nonnull node) {
node.yogaLayoutInProgress = YES;
Expand Down

0 comments on commit b20e007

Please sign in to comment.