• 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
can you autorelease toll-free bridged types
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

can you autorelease toll-free bridged types


  • Subject: can you autorelease toll-free bridged types
  • From: Roland King <email@hidden>
  • Date: Wed, 1 Sep 2010 00:02:08 +0800

can you do this?

	CFMutableDictionaryRef tokenByParent = CFDictionaryCreateMutable( NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks );
	[ (NSMutableDictionary*)tokenByParent autorelease ];

with of course the desire to continue using tokenByParent in the routine.

CFMutableDictionaryRef is toll-free bridged with NSMutableDictionary but does that that extend to autoreleasing it?

Normally I balance alloc/init with release and CF..Create.. with CFRelease(), in this case I have deeply nested code iterating over a database and there are multiple ways it can fail, I'm testing for the failures and returning appropriate errors but don't want to have to deal with figuring out what I need to release at 10 different exit points to the routine so I'd like to just use autorelease and let someone else worry about it. The alternative is either massive nested if() code or abusing @try/@finally with no @catch to release everything on the way out the door.

Is it ok to cast a CF object to an NS object for the purpose of autoreleasing it? _______________________________________________

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: can you autorelease toll-free bridged types
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Re: NSCell and partial redraw
  • Next by Date: Re: NSCell and partial redraw
  • Previous by thread: Re: NSCell and partial redraw
  • Next by thread: Re: can you autorelease toll-free bridged types
  • Index(es):
    • Date
    • Thread