Re: drawRect runs twice, bounds are changed in between
Re: drawRect runs twice, bounds are changed in between
- Subject: Re: drawRect runs twice, bounds are changed in between
- From: Graham Cox <email@hidden>
- Date: Thu, 29 Jan 2015 15:30:23 +1100
> On 29 Jan 2015, at 3:05 pm, N!K <email@hidden> wrote:
>
> NSBezierPath* temp; is in the list of declarations.
> This snippet is in drawRect:
>
> NSAffineTransform* tfm = [[NSAffineTransform alloc] init];
> [tfm scaleXBy:scaleX yBy:scaleY];
> temp = [tfm transformBezierPath:_path];
> NSLog(@“\n\n temp = %p\n\n",temp);
>
>
> I hope ARC keeps cleaning them up. Or do I have a memory leak? If so, I’d appreciate some guidance on how to fix it.
You're fine leaks-wise, but your code might be cleaner. The bezier path returned by [tfm transformBezierPath] is autoreleased. ARC cleans up tfm, temp is released at the end of the event cycle. If temp is an ivar, and it's not used anywhere else, just make it a local var (it will be stale after the event cycle completes anyway). If it's an ivar and it is referenced elsewhere, you probably should make it a strong property instead.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden