Merely accessing UIViewController.presentationController causes overretain

Originator:zacwest
Number:rdar://21753811 Date Originated:09-Jul-2015 02:17 PM
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 9, iOS 8
Classification:Serious Bug Reproducible:Always
 
Summary:
If a modally-presented UIViewController accesses its presentationController -- just to log it, just to inspect the class, etc. -- it will never be deallocated when dismissed.

Attached is a sample project which reproduces it with very minimal code. There are two defines:
1. Log the controller after dismiss (using a weak ptr and a timer)
2. Log the presentation controller after the view appears.

The only required one to reproduce is the latter. I've reproduced this under iOS 9 as well as iOS 8, unfortunately.

Steps to Reproduce:
1. Access a UIViewController's presentationController
2. Watch the lifecycle of the UIViewController from that point forward.
3. Note the UIViewController never deallocates again.

Expected Results:
The UIViewController is not overretained by calling .presentationController.

Actual Results:
The UIViewController is overretained by calling .presentationController.

Version:
Xcode 7.0 beta 3 (7a152u) & Xcode 6.4 (6e35b)

Notes:


Configuration:
iOS Simulator - iOS 9 and iOS 8.3

Attachments:
'PresentedControllerOverretain.zip' was successfully uploaded.


Sample code: https://bitbucket.org/zacwest/presentedcontrolleroverretain

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!