Re: Calling autorelease on CFAllocated objects?
Re: Calling autorelease on CFAllocated objects?
- Subject: Re: Calling autorelease on CFAllocated objects?
- From: "Ken Ferry" <email@hidden>
- Date: Fri, 11 Jul 2008 03:48:56 -0700
One caveat: If you're writing code that needs to function with
garbage collection on, CFRelease and -release are not equivalent. See
http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcCoreFoundation.html
for details, but the form thats safe for both gc and non-gc is
[NSMakeCollectable(someCFThing) autorelease].
-Ken
On Wed, Jul 9, 2008 at 4:47 PM, Wade Tregaskis <email@hidden> wrote:
>> http://www.cocoabuilder.com/archive/message/cocoa/2008/7/5/212046
>>
>> I wish this were better documented; the Search Kit docs show autorelease
>> being sent to an SKDocumentRef, also, and that's always made me nervous (I
>> think I actually sent feedback on that one a long time ago).
>
> I do apologise, you are absolutely correct. The confusion arises from the
> fact that the term "toll-free bridging" is used to describe CF objects that
> have real NS equivalents, functionally. In fact, all CF objects are
> bridged, in a functional sense - just that by default they're bridged to
> essentially NSObject so all you get is the basic NSObject functionality.
>
> So my previous answer was actually right, just not helpful. :D
>
> The documentation could be clearer, yes. I just filed a bug report myself,
> which I know isn't the first, but if you do encounter places in the
> documentation which talk about toll-free bridging and are ambiguous or
> seemingly contrary to this, please file bug reports for those specifically.
>
> Wade
> _______________________________________________
>
> 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
>
_______________________________________________
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