Re: Fire-and-forget controllers with blocks
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