• 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: CFDictionarySetValue and ARC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFDictionarySetValue and ARC


  • Subject: Re: CFDictionarySetValue and ARC
  • From: Greg Parker <email@hidden>
  • Date: Mon, 17 Oct 2011 12:50:23 -0700

On Oct 15, 2011, at 8:20 PM, Roland King wrote:
> I don't think I want either __bridge_transfer or __bridge_retained, the former is for passing things back to obj-c classes and the latter I believe effectively transfers ownership and would require an extra CFRelease() which isn't going to happen, I don't want to transfer ownership, the dictionary will take its own ownership.

If you are familiar with retain/release logic then you may find that CFBridgingRetain() and CFBridgingRelease() make more sense than __bridge_transfer and __bridge_retained.

CFBridgingRetain() converts id to void* and retains it. You must balance it with a subsequent CFRelease() or CFBridgingRelease(). Let ARC do what it wants with the id side.

CFBridgingRelease() converts void* to id and releases it. You must balance it with a prior CFRetain() or CFBridgingRetain() or CFCreate(). Let ARC do what it wants with the id side.

__bridge cast converts id to void* or void* to id with no retain count changes.


--
Greg Parker     email@hidden     Runtime Wrangler


_______________________________________________

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: CFDictionarySetValue and ARC
      • From: Brent Fulgham <email@hidden>
References: 
 >CFDictionarySetValue and ARC (From: Roland King <email@hidden>)

  • Prev by Date: Re: Blocks vs. life, the universe and everything
  • Next by Date: Re: CFDictionarySetValue and ARC
  • Previous by thread: Re: CFDictionarySetValue and ARC
  • Next by thread: Re: CFDictionarySetValue and ARC
  • Index(es):
    • Date
    • Thread