Re: Questions regarding release
Re: Questions regarding release
- Subject: Re: Questions regarding release
- From: John McCall via Cocoa-dev <email@hidden>
- Date: Thu, 26 Sep 2019 14:08:28 -0400
On 26 Sep 2019, at 12:47, Gabriel Zachmann via Cocoa-dev wrote:
I don’t believe that’s entirely true. “make” methods return a
+0 value.
The issue in the below code to my eye is that you allocate a path
with CGPathCreateWithRect (+1) but then don't release it.
In that case, I am wondering:
doesn't ownership pass to the textlayer ?
If yes, shouldn't textlayer release the path when it gets destroyed by
the ARC?
`CALayer` will indeed release `shadowPath` when it’s deallocated.
However, `CALayer.setShadowPath` doesn’t expect to be passed a +1
reference, so it will retain/copy its argument, and it’s that retain
which will be balanced by the release during object destruction.
Functions and methods generally do not expect to be passed +1 objects.
John.
_______________________________________________
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