Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXC_BAD_ACCESS with errorBlock #6

Open
guyschlider opened this issue Feb 10, 2015 · 2 comments
Open

EXC_BAD_ACCESS with errorBlock #6

guyschlider opened this issue Feb 10, 2015 · 2 comments

Comments

@guyschlider
Copy link

Hi,

I guess when the user denies the photos permission the errorBlock should be called, but I can see on crashlytics crashes that says
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000000000010
coming from this part of the code:

failureBlock: ^(NSError *error) {
if (self.errorBlock) {
dispatch_async(dispatch_get_main_queue(), ^() {
self.errorBlock(error);
});
}

Any ideas?

@clayallsopp
Copy link
Owner

Yeah - at a glance there are some problems with my original implementation. One is that self is referenced inside that block without being weak-ified, i.e.

__weak ShotBlocker *weakSelf = self;
... failureBlock: ^(NSError *error) {
  if (weakSelf.errorBlock) {
    // sort of thing
  }
}];

(or maybe keep the failureBlock around as a strong-referenced ivar?)

There's probably more of these sort of errors in the code. I don't have any time to audit them, but I'd welcome any PRs which addressed them!

@guyschlider
Copy link
Author

Yeah I actually came up with the same solution after digging into it.

Will try to submit a PR tomorrow.

thanks alot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants