• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Questions regarding release
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Questions regarding release


  • Subject: Re: Questions regarding release
  • From: Gabriel Zachmann via Cocoa-dev <email@hidden>
  • Date: Fri, 27 Sep 2019 01:20:02 +0200

> 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.

So, if I understand you correctly, I should do this:

    textlayer.shadowPath = CGPathCreateWithRect( textlayer.bounds, NULL );
   CFRelease( textlayer.shadowPath )

?
Is that correct?

Best regards, Gabriel



Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

  • Follow-Ups:
    • Re: Questions regarding release
      • From: James Walker via Cocoa-dev <email@hidden>
    • Re: Questions regarding release
      • From: Rob Petrovec via Cocoa-dev <email@hidden>
References: 
 >Re: Questions regarding release (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)
 >Re: Questions regarding release (From: "Glenn L. Austin via Cocoa-dev" <email@hidden>)
 >Re: Questions regarding release (From: Mike Abdullah via Cocoa-dev <email@hidden>)
 >Re: Questions regarding release (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)
 >Re: Questions regarding release (From: John McCall via Cocoa-dev <email@hidden>)

  • Prev by Date: Re: Questions regarding release
  • Next by Date: Re: Questions regarding release
  • Previous by thread: Re: Questions regarding release
  • Next by thread: Re: Questions regarding release
  • Index(es):
    • Date
    • Thread