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

App crash on completion block to unowned self #120

Closed
steviemo opened this issue Jul 18, 2018 · 6 comments
Closed

App crash on completion block to unowned self #120

steviemo opened this issue Jul 18, 2018 · 6 comments

Comments

@steviemo
Copy link

Hey thanks for the awesome library!

I have uncovered an issue though in my app where I require to reload a view (which contains a few checkbox) in quick succession. My app is crashing at line 127 in the M13CheckboxStrokeController.swift:

CATransaction.setCompletionBlock({ [unowned self] () -> Void in
    self.resetLayersForState(self.state)
    completion?()
    })

Should self not be weak with null checks on self? If you agree I could submit a PR for the fix ASAP. I'd say it would be safer to update the three completion blocks in this class from unowned to weak so handle the checkbox being created and destroyed quickly.

Thanks,
Stephen

@steviemo
Copy link
Author

Just an FYI I made the changes to weak self and everything working as expected.

@gverdouw
Copy link

I'm hitting the same issue in my own app

@ke7insud
Copy link

ke7insud commented Aug 6, 2018

I am still getting this issue. It has not been fixed.

@fjsosa
Copy link

fjsosa commented Aug 13, 2018

Same issue here

@andreaantonioni
Copy link
Collaborator

I just merged a PR that fixes this #121 and I'll publish a new version with this fix

@tnmendes
Copy link

I am using the last version M13Checkbox (3.4.0) and is happening the same issue.
This error is happening when I am doing the animation but before it finished I press a button to popToRooViewController.

} else {
            let fromPath = pathGenerator.pathForMark(fromState)
            let toPath = pathGenerator.pathForMark(toState)
            
            let morphAnimation = animationGenerator.morphAnimation(fromPath, toPath: toPath)
            
            CATransaction.begin()
            CATransaction.setCompletionBlock({ [unowned self] () -> Void in
                self.resetLayersForState(self.state)
                completion?()
                })
            
            markLayer.add(morphAnimation, forKey: "path")
            
            CATransaction.commit()
        }

on line 145:
self.resetLayersForState(self.state)
Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1c053daf4)

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

6 participants