Re: cannot form weak reference to ..
Re: cannot form weak reference to ..
- Subject: Re: cannot form weak reference to ..
- From: Matt Neuburg <email@hidden>
- Date: Sat, 07 Jan 2012 09:35:22 -0800
On Wed, 04 Jan 2012 00:26:17 +0800, Roland King <email@hidden> said:
>I have this line of code, just before a block is enqueued onto a dispatch queue. weakSelf is used in that block.
>
> RKHIPCard __weak *weakSelf = self;
>
>which is generating the following error
>
> objc[15245]: cannot form weak reference to instance (0x89b4100) of class RKHIPCard
>
>in certain very occasional circumstances. A bit of logging and it's clear that those circumstances are when the RKHIPCard, self, is in the middle of being deallocated.
Watch the WWDC 2011 video again; you're explicitly told that this is exactly why the weak-strong dance includes a nil test against the strong self inside the block. m.
--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________
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