STPopup icon indicating copy to clipboard operation
STPopup copied to clipboard

Check for nil viewcontroller when removing observer

Open artonragsdale opened this issue 9 years ago • 2 comments

STPopup may lose its reference to view controller, especially after memory warning, causing bad access crash. Checking for existence of view controller before removing observer prevents the crash

artonragsdale avatar Aug 19 '16 01:08 artonragsdale

@artonragsdale _viewControllers in STPopupController holds strong reference of UIViewController, and it's not cleaned up when memory warning is received. Even it's set to nil, calling a function to nil will not crash. Do you have any crash log on this issue?

kevin-lyn avatar Aug 19 '16 04:08 kevin-lyn

@kevin0571 I actually fixed this a while ago and just got around to submitting a pull request but it did solve a crash bug my app was experiencing. I'll have to look back through old crash reports to see if I can find it.

artonragsdale avatar Aug 19 '16 05:08 artonragsdale