NewsstandKit not retaining currentlyReading issue

Originator:doug
Number:rdar://10705303 Date Originated:01-16-2012
Status:Closed Resolved:
Product:iPhone SDK Product Version:5.0
Classification:Crash Reproducible:Always
 
Summary:I've supplied sample code where if you run the code in the first #if block and make sure the issue exists, then quit and run the second block, the app crashes on an NKIssue overrelease. I've also attached an instrument trace showing the overrelease.

Steps to Reproduce: Launch app with the first #if block enabled. Check that the issue has been created (this is easier in simulator), then stop app and relaunch with the second block enabled and the app will crash on an exc_bad_access.

Expected Result: No overrelease

Actual Results: Overrelease.

Regression:

Notes:

Trace:
http://cl.ly/3e3M0t0t1m2E043v283j

Code:
http://cl.ly/0F1y0T0o2G3305071r3X


Followup with recommended fix:

if ([[[UIDevice currentDevice] systemVersion] isEqualToString:@"5.0"])
   CFBridgingRetain([[NKLibrary sharedLibrary] currentlyReadingIssue]);

Which I adapted that into to cover 4.x support:

if ([NKLibrary self] && [[[UIDevice currentDevice] systemVersion] isEqualToString:@"5.0"]) {
#ifndef __clang_analyzer__ //Suppress leak warning
     CFBridgingRetain([[NKLibrary sharedLibrary] currentlyReadingIssue]);
#endif
}

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!