Skip to content
This repository was archived by the owner on Apr 29, 2020. It is now read-only.

Fix memory management for static block variables in UIAlertView+MKBlockAdditions#5

Open
albertodebortoli wants to merge 4 commits intoMKSG-MugunthKumar:masterfrom
albertodebortoli:master
Open

Fix memory management for static block variables in UIAlertView+MKBlockAdditions#5
albertodebortoli wants to merge 4 commits intoMKSG-MugunthKumar:masterfrom
albertodebortoli:master

Conversation

@albertodebortoli
Copy link

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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting errors on these lines:

UIAlertView+MKBlockAdditions.m:108:6: Use of undeclared identifier '_cancelBlock'
UIAlertView+MKBlockAdditions.m:109:5: Unknown type name '_cancelBlock'; did you mean 'CancelBlock'?

@drewish
Copy link

drewish commented Aug 13, 2012

I think that should probably be:

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

@drewish
Copy link

drewish commented Aug 13, 2012

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
Copy link

drewish commented Aug 13, 2012

Okay I rebased your commit and fixed that: drewish@1994aa5

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants