Skip to content

Commit

Permalink
Merge pull request #115 from cysp/bugfix/retain-cgcolors
Browse files Browse the repository at this point in the history
Retain CGColorRefs
  • Loading branch information
fjolnir authored Mar 19, 2018
2 parents 78cee07 + bcd84fa commit 350feea
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions SVGLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ - (instancetype)initWithCoder:(NSCoder * const)aDecoder
return self;
}

- (void)dealloc
{
CGColorRelease(_fillColor);
CGColorRelease(_strokeColor);
}

- (void)setPaths:(NSArray<SVGBezierPath*> *)paths
{
[self willChangeValueForKey:@"paths"];
Expand Down Expand Up @@ -86,13 +92,19 @@ - (void)setPaths:(NSArray<SVGBezierPath*> *)paths

- (void)setFillColor:(CGColorRef)aColor
{
CGColorRetain(aColor);
CGColorRelease(_fillColor);
_fillColor = aColor;

[_shapeLayers setValue:(__bridge id)_fillColor forKey:@"fillColor"];
}

- (void)setStrokeColor:(CGColorRef)aColor
{
CGColorRetain(aColor);
CGColorRelease(_strokeColor);
_strokeColor = aColor;

[_shapeLayers setValue:(__bridge id)_strokeColor forKey:@"strokeColor"];
}

Expand Down

0 comments on commit 350feea

Please sign in to comment.