Niling out the root view controller no longer cleans up the view controller hierarchy
| Originator: | stephenpoletto | ||
| Number: | rdar://18535358 | Date Originated: | 02-Oct-2014 08:17 PM |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 8.0 (12A365) |
| Classification: | Serious Bug | Reproducible: | Always |
Summary: On iOS 7, developers could nil out the application window's root view controller as a mechanism of tearing down the view controller hierarchy. Under iOS 8, this no longer holds true. If a modal view controller is presented over the top of the root view controller, then niling out the root view controller has different behavior depending on whether or not the root view controller issues a request to dismiss all modals as part of the teardown procedure. The two possible outcomes are: 1) The view controllers within the view controller hierarchy will remain in resident application memory (i.e. not be deallocated). The associated views will remain on screen. 2) The view controllers within the view controller hierarchy will be deallocated. However, the base view controller's view will remain on screen. This can result in the user interacting with elements within the view which message a deallocated view controller, and therefore crash the application. Sample Project: https://www.dropbox.com/s/huthv18x132wz29/MemLeaks.zip?dl=0 Steps to Reproduce: See the attached sample project. Run the project on both iOS 7 and iOS 8 target devices. Expected Results: In all cases, the expected behavior when the root view controller is set to nil is that: 1) Any view controllers which were on screen are deallocated. 2) The screen goes blank. Actual Results: When a modal view controller is presented over the root view controller, the view controller hierarchy is not cleaned up properly. See the comments within the sample project for a more concrete explanation. Version: iOS 8.0 Notes: Configuration: iPhone 5 Attachments: 'MemLeaks.zip' was successfully uploaded.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!