UIKitCategoryAdditions icon indicating copy to clipboard operation
UIKitCategoryAdditions copied to clipboard

Fix memory management for static block variables in UIAlertView+MKBlockAdditions

Open albertodebortoli opened this issue 13 years ago • 3 comments

If objects referenced in the blocks are deallocated, in the next invocation of alertViewWithTitle:message:cancelButtonTitle:otherButtonTitles:onDismiss:onCancel: block arguments still reference to deallocated instances causing crash. Fix the case if more than one UIAlertView is shown using block-based category method. Add thread safety.

albertodebortoli avatar Mar 01 '12 23:03 albertodebortoli

I think that should probably be:

[alertView.cancelBlock release];
alertView.cancelBlock = nil;
[alertView.dismissBlock release];
alertView.dismissBlock = nil;

drewish avatar Aug 13 '12 20:08 drewish

Yeah so it looks like pull request #7 made those into dynamic properties. I'm not sure if your change is still necessary but it should probably become something more like what I showed above.

drewish avatar Aug 13 '12 20:08 drewish

Okay I rebased your commit and fixed that: https://github.com/drewish/UIKitCategoryAdditions/commit/1994aa5e5c3da51313c419296b2127ea5d7515f3

drewish avatar Aug 13 '12 20:08 drewish