On Mar 16, 2009, at 2:08 PM, Bill Cheeseman wrote:

I am looking for a strategy to avoid implementing a -finalize method in a garbage-collected Objective-C class that declares a CFTypeRef- style Core Foundation instance variable. I believe this is a fairly common problem, because any Cocoa wrapper class for a Core Foundation API would have to do it, but I haven't seen a usable solution. Apple's GC documentation stops just short of suggesting an answer.


I believe you're supposed to declare your CFTypeRef ivar as __strong and call CFMakeCollectable so that the garbage collector will be responsible for releasing it. You can still use CFRelease in -dealloc for when you aren't running under garbage collection.

--Michael


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to