Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions AsyncDisplayKit/ASTextNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ @interface ASTextNode () <UIGestureRecognizerDelegate, NSLayoutManagerDelegate>
@implementation ASTextNode {
CGSize _shadowOffset;
CGColorRef _shadowColor;
UIColor *_cachedShadowUIColor;
CGFloat _shadowOpacity;
CGFloat _shadowRadius;

Expand Down Expand Up @@ -232,6 +233,10 @@ - (ASTextKitAttributes)_rendererAttributes
.pointSizeScaleFactors = self.pointSizeScaleFactors,
.layoutManagerCreationBlock = self.layoutManagerCreationBlock,
.textStorageCreationBlock = self.textStorageCreationBlock,
.shadowOffset = _shadowOffset,
.shadowColor = _cachedShadowUIColor,
.shadowOpacity = _shadowOpacity,
.shadowRadius = _shadowRadius
};
}

Expand Down Expand Up @@ -1043,7 +1048,11 @@ - (void)setShadowColor:(CGColorRef)shadowColor
if (shadowColor != NULL) {
CGColorRetain(shadowColor);
}
if (_shadowColor != NULL) {
CGColorRelease(_shadowColor);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... I think we need to move this out of the if statement and wrap it in a new one: if (_shadowColor != NULL) because no matter what the new value is, if we have an old value we must release it

}
_shadowColor = shadowColor;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're already in this code, could you add if (_shadowColor != NULL) { CGColorRelease(_shadowColor); } so we stop leaking them 🚰

Copy link
Contributor Author

@maicki maicki Aug 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On it 👷

_cachedShadowUIColor = [UIColor colorWithCGColor:shadowColor];
[self _invalidateRenderer];
[self setNeedsDisplay];
}
Expand Down