Grab propertyLock to get supportsRangeManagedInterfaceState and for asking dirty layout status

This commit is contained in:
Michael Schneider 2016-07-15 11:55:43 -07:00
parent 20a49f037b
commit fcfce5128d

View File

@ -1135,9 +1135,19 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
- (void)measureNodeWithBoundsIfNecessary:(CGRect)bounds
{
BOOL supportsRangedManagedInterfaceState = NO;
BOOL hasDirtyLayout = NO;
BOOL hasSupernode = NO;
{
ASDN::MutexLocker l(_propertyLock);
supportsRangedManagedInterfaceState = [self supportsRangeManagedInterfaceState];
hasDirtyLayout = [self _hasDirtyLayout];
hasSupernode = (self.supernode != nil);
}
// Normally measure will be called before layout occurs. If this doesn't happen, nothing is going to call it at all.
// We simply call measureWithSizeRange: using a size range equal to whatever bounds were provided to that element
if (self.supernode == nil && !self.supportsRangeManagedInterfaceState && [self _hasDirtyLayout]) {
if (!hasSupernode && !supportsRangedManagedInterfaceState && hasDirtyLayout) {
if (CGRectEqualToRect(bounds, CGRectZero)) {
LOG(@"Warning: No size given for node before node was trying to layout itself: %@. Please provide a frame for the node.", self);
} else {