• 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: Fire-and-forget controllers with blocks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fire-and-forget controllers with blocks


  • Subject: Re: Fire-and-forget controllers with blocks
  • From: Kyle Sluder <email@hidden>
  • Date: Fri, 20 May 2011 08:46:09 -0700

On Fri, May 20, 2011 at 5:48 AM, Ben <email@hidden> wrote:
> controller = [[MyImportController alloc] initWithCleanupBlock:[[cleanup copy] autorelease]];

Nitpick: the caller of -initWithCleanupBlock: should not be
responsible for the memory management of the block. Rather,
-initWithCleanupBlock: should copy the block:

- (id)initWithCleanupBlock:(void(^)(void))cleanupBlock {
  if ((self = [super init]))
    _cleanupBlock = [cleanupBlock copy];

  return self;
}

--Kyle Sluder
_______________________________________________

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

References: 
 >Fire-and-forget controllers with blocks (From: Ben <email@hidden>)

  • Prev by Date: Re: [NSLock dealloc] Exception
  • Next by Date: Re: Thumbnail view like iPhone Photos app
  • Previous by thread: Re: Fire-and-forget controllers with blocks
  • Next by thread: [NSLock dealloc] Exception
  • Index(es):
    • Date
    • Thread