Skip to content
This repository has been archived by the owner on Oct 23, 2019. It is now read-only.

Commit

Permalink
Return copy of a layer
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Jul 27, 2015
1 parent af28d6d commit 54e78a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion IAColorBackgroundRenderer.m
Expand Up @@ -35,7 +35,11 @@ -(id)initWithColor:(NSColor*)c
}

-(CALayer *)getLayer {
return layer;
CALayer *newLayer = [CALayer new];
CGColorRef color = CGColorCreateCopy(layer.backgroundColor);
newLayer.backgroundColor = color;
CGColorRelease(color);
return [newLayer autorelease];
}

- (void)dealloc
Expand Down
9 changes: 8 additions & 1 deletion IAPatternBackgroundRenderer.m
Expand Up @@ -34,7 +34,14 @@ - (id)init
}

-(CALayer *)getLayer {
return bgLayer;
CALayer *newLayer = [CALayer new];
newLayer.actions = [[bgLayer.actions copy] autorelease];

CGColorRef color = CGColorCreateCopy(bgLayer.backgroundColor);
newLayer.backgroundColor = color;
CGColorRelease(color);

return [newLayer autorelease];
}

-(void)dealloc {
Expand Down

0 comments on commit 54e78a9

Please sign in to comment.