• 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: blocks and retaining CoreFoundation objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: blocks and retaining CoreFoundation objects


  • Subject: Re: blocks and retaining CoreFoundation objects
  • From: David Duncan <email@hidden>
  • Date: Tue, 9 Aug 2011 10:05:57 -0700

On Aug 8, 2011, at 11:43 PM, Roland King wrote:

> After a bit of googling I came across some posts which explained Block_Copy() would treat a variable adorned with __attribute__((NSObject)) similarly to NSObjects and retain them. So changing the method signature to this
>
> 	-(void)convert:(__attribute__((NSObject))CGImageRef)image withBlock:(ImageResizedBlock)callbackBlock
>
> appears to do the right thing in my testing, the CGImageRef is CFRetain()ed when the block is enqueued and I assume CFRelease()d later. I prefer this syntax, as I find it self-documenting;
>
> I can't find anywhere apart from blog posts and the block specification itself which says this works. Does anyone know if it's officially supported, for gcc and clang and something that apple is likely to support going forward into ARC

The ARC specification defines a "retainable pointer" as including those pointers that have the __attribute__((NSObject)) decoration, so this should behave as expected under ARC. <http://clang.llvm.org/docs/AutomaticReferenceCounting.html#objects>
--
David Duncan

_______________________________________________

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: blocks and retaining CoreFoundation objects
      • From: Fritz Anderson <email@hidden>
References: 
 >blocks and retaining CoreFoundation objects (From: Roland King <email@hidden>)

  • Prev by Date: Re: Scanning images
  • Next by Date: Re: Using #define a good way for String constants, like enums for NSIntegers?
  • Previous by thread: blocks and retaining CoreFoundation objects
  • Next by thread: Re: blocks and retaining CoreFoundation objects
  • Index(es):
    • Date
    • Thread