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

Already on GitHub? Sign in to your account

Crash when dismissing popover #79

Open
drewmca opened this Issue Feb 20, 2014 · 2 comments

Comments

Projects
None yet
2 participants

drewmca commented Feb 20, 2014

I have a popover controller that contains a UICollectionView of items for selection. In my "didDismiss" delegate method, I set the popover property on my calling view controller to nil. The popover is triggered by a button press on that calling view controller.

If the user is scrolling through the collection view (i.e., the scroll animation is in process) when the popover is dismissed, I get a crash on "message sent to deallocated instance" (the message was sent to the content view controller of the dismissed popover). This happens every time.

It looks like when the popover is dismissed, any animations on its content view controller aren't properly canceled, so after the popover is dismissed, there are still timed post-animation calls on the scrolling of the UIViewController that are firing, but trying to fire on a deallocated object. These are just the normal, built in UIViewController animation calls, nothing fancy, and nothing that can be turned off.

I can make the problem go away in my "didDismiss" call with the following line of code:

[self.popover.contentViewController.view removeFromSuperview];

However, it feels like this is something that should be happening internally, when the popover itself is handling its dismissal. Any thoughts?

Owner

nicolaschengdev commented Feb 20, 2014

Hi,

In the Demo app, it uses an UITableView.
If you start to scroll through cells, tap on Done button before the end of scrolling then the popover is correctly dismissed without crashes.
I think it's a similar case than yours.

Please use master branch of repo and give it a try. Or give me a sample code.

Owner

nicolaschengdev commented Feb 25, 2014

@drewmca ping

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