zwaldowski/BlocksKit — Issue #59: Crash in setDeallocHandler
Author: nicked
Created: 2012-01-12 10:00:21+00:00
State: open

I have a view controller which contains a UIWebView. I'm not using any BlocksKit methods with this web view.

In the view controllers dealloc method, when I set the webview's delegate to nil I get this crash:

#6	0x00022942 in -[WebViewController dealloc] at ViewControllers/WebViewController.m:266 <- set delegate to nil here
#5	0x00093e5a in __79+[NSObject(A2BlockDelegateBlocksKit) registerDynamicDelegateNamed:forProtocol:]_block_invoke_0 at BlocksKit/BlocksKit/A2BlockDelegate+BlocksKit.m:239
#4	0x00092781 in -[A2DynamicDelegate(A2BlockDelegate) setRealDelegate:] at BlocksKit/BlocksKit/A2BlockDelegate+BlocksKit.m:79
#3	0x0009335c in -[NSObject(A2BlockDelegateBlocksKitPrivate) setDeallocHandler:] at BlocksKit/BlocksKit/A2BlockDelegate+BlocksKit.m:174

The line that crashes is:
objc_setAssociatedObject(self, _cmd, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
with:
-[A2BlockDelegateDeallocHandler release]: message sent to deallocated instance 0x8088a40