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
customBarViewController is nil after dismissPopupBar but still retained by LNPopupBar #232
Comments
Thank you for the great report! |
Considering how the system works, the popup bar itself is created on demand and only released when the presenting controller is released. This is to allow, for example, customization done by the user to persist between presentations. I do however see a problem where cleanup should be performed after dismissing the popup. |
It would be fine for me if the popup bar is not released until the presenting view controller is released. But it seems a new popup bar instance is created on every present. |
Only one bar should be created per presenting controller. |
Yes, I see what you mean. Investigating |
//No longer need to retain the popup controller after dismissing.
objc_setAssociatedObject(self, _LNPopupControllerKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC); Well that about will do it 😆 |
OK, found a leak that caused previous bars to remain in memory. But I still think the correct behavior of the system should be to only release the bar upon the presentation controller release. |
Please try now with 2.5.11. Thanks |
fix confirmed. thanks! |
I'm setting a customBarViewController like this:
when I'm dismissing the popupBar the
customBarViewController
property becomes nilHowever the
PopupBarViewController
instance is not deallocated and according to Xcode's Memory Graph Debugger it is still retained by an instance ofLNPopupBar
.If I repeat to present and dismiss the popupBar like this I accumulate instances of
PopupBarViewController
that are all retained by different instances ofLNPopupBar
.If I keep a reference to the
PopupBarViewController
instance myself and reuse that to set it to thepopupBar.customBarViewController
property everytime I'm going to present the popupBar, thePopupBarViewController
instance will be retained by manyLNPopupBar
instances.Seems to me that
LNPopupBar
instances are not released when they should be (after dismissPopupBar).I'm using
LNPopupController v2.5.10
Xcode 9.2
The text was updated successfully, but these errors were encountered: