From ee18b9cd6c5db4693e697d7fe352af699b489cbd Mon Sep 17 00:00:00 2001 From: Rahul Malik Date: Wed, 18 Sep 2019 09:15:32 -0700 Subject: [PATCH] Use backgroundColor ivar instead of property access in traitCollectionDidChange (#1678) traitCollectionDidChange isn't necessarily called on Main, but our self.backgroundColor property access must be done on main once the view is loaded. I originally opted to use self.backgroundColor rather than _backgroundColor in #1674, but I think we should use the ivar here. This could get out-of-sync if someone modified the UIView's background color instead of updating the node, but I think that's unlikely, so we should be safe to use the ivar here. --- Source/ASDisplayNode.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/ASDisplayNode.mm b/Source/ASDisplayNode.mm index fc18a68e8..ffbdc07ec 100644 --- a/Source/ASDisplayNode.mm +++ b/Source/ASDisplayNode.mm @@ -445,7 +445,7 @@ - (void)asyncTraitCollectionDidChangeWithPreviousTraitCollection:(ASPrimitiveTra BOOL needsClippingCornerUpdate = NO; CGFloat cornerRadius = _cornerRadius; ASCornerRoundingType cornerRoundingType = _cornerRoundingType; - UIColor *backgroundColor = self.backgroundColor; + UIColor *backgroundColor = _backgroundColor; if (_loaded(self)) { if (self.isLayerBacked) { // Background colors do not dynamically update for layer backed nodes since they utilize CGColorRef