-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Crash when using a block with a UIButton #5
Comments
I'll fix it "better" later on, but it's fixed for now. Thanks for the contribution! |
It still crashes, after your latest changes. The problem seems to be the BK_RELEASE(target) in addEventHandler:forControlEvents. I think the problem is that you're releasing target there, but you add it as a target to the UIControl a line above, and when it comes to the point where the invoke: selector is to be called, target is already released. I've commented out BK_RELEASE(target) on line 64 and it works but it leaks. Any ideas? Thanks, |
I'll investigate again, but it should really be retained by being On Jul 4, 2011, at 9:24 AM, siancu
|
I've fixed it in my fork, see here: https://github.com/siancu/BlocksKit/commit/6508502b1a4fc34620b50cf15cc8a54018ef8885 I could open a pull request if you wish. |
I know it would be like that, ahaha. Thanks! Yeah, go ahead and send a On Jul 4, 2011, at 9:46 AM, siancu
|
Sent it: #9 |
Hi,
I've added a UIButton to my code and I've added an event handler to it. How, when I am pressing the button, the code crashes with EXC_BAD_ACCESS.
I've ran the test app in Instruments with Zombies selected and I've noticed that the problem was in UIControl+BlocksKit.m, lines 31-34. I've also debugged the issue and it seems that the instance of the BKControlWrapper is released twice.
So I've managed to fix the issue by adding a BK_RETAIN(target) here:
I've ran the app in Instruments with Leaks after this change and there are no leaks.
Please add this fix into the code.
Thanks,
Stelian
The text was updated successfully, but these errors were encountered: