MKTileOverlay crash when MKMapViewDelegate is dereferenced

Originator:kent
Number:rdar://17089661 Date Originated:June 1, 2014
Status:Duplicate of 15549095 (Closed) Resolved:
Product:iOS SDK Product Version:7.0+
Classification:Serious Bug Reproducible:Always
 
Summary:
MapKit is crashing.

This happens if the MKMapView is deallocated, before the TileOverlay has had a chance to respond from the URL.

Steps to Reproduce:
1. Add an MKTileOverlay which was initialized with a URL template to a MKMapView.
2. return the default renderer [[MKTileOverlayRenderer alloc] initWithTileOverlay:overlay] in the mapView's delegate method -[mapView:rendererForOverlay:] 
3. Navigate away from this ViewController in a way that will not keep it in memory (go back instead of to a next page)
4. Wait for the network request to finish
5. Inspect why it's crashing....

Expected Results:
MapKit to stop attempting to download information when it's no longer needed, as well as not returning that information to deallocated instances

Actual Results:
iPhone 5:
2014-06-01 05:17:39.934 Rex[2253:60b] *** -[VKRasterOverlayTileSource invalidateRect:level:]: message sent to deallocated instance 0x15823300
(lldb) po [NSThread callStackSymbols]
<_NSCallStackArray 0x1b8152c0>(
0   ???                                 0x01c62654 0x0 + 29763156,
1   MyApp                                 0x0013c2a9 main + 0,
2   CoreFoundation                      0x2ed38098 _CF_forwarding_prep_0 + 24,
3   VectorKit                           0x36ce915f <redacted> + 134,
4   MapKit                              0x2ffff403 <redacted> + 90,
5   MapKit                              0x30007699 <redacted> + 152,
6   MapKit                              0x30004b89 <redacted> + 112,
7   GeoServices                         0x33b0ae27 <redacted> + 54,
8   libdispatch.dylib                   0x39a66d53 <redacted> + 10,
9   libdispatch.dylib                   0x39a66d3f <redacted> + 22,
10  libdispatch.dylib                   0x39a696c3 _dispatch_main_queue_callback_4CF + 278,
11  CoreFoundation                      0x2edb1681 <redacted> + 8,
12  CoreFoundation                      0x2edaff4d <redacted> + 1308,
13  CoreFoundation                      0x2ed1a769 CFRunLoopRunSpecific + 524,
14  CoreFoundation                      0x2ed1a54b CFRunLoopRunInMode + 106,
15  GraphicsServices                    0x33c876d3 GSEventRunModal + 138,
16  UIKit                               0x31679891 UIApplicationMain + 1136,
17  MyApp                                 0x0013c31d main + 116,
18  libdyld.dylib                       0x39a7bab7 <redacted> + 2
)

Version:
iOS 7.1.1 (11D201)

Notes:
Simulator:
2014-06-01 04:44:10.209 Rex[14364:60b] *** -[VKRasterOverlayTileSource invalidateRect:level:]: message sent to deallocated instance 0xc7ea930
(lldb) po [NSThread callStackSymbols]
<_NSCallStackArray 0x14fad1a0>(
0   ???                                 0x144f74ed 0x0 + 340751597,
1   MyApp                                 0x00073ea0 main + 0,
2   CoreFoundation                      0x027250ee _CF_forwarding_prep_0 + 14,
3   VectorKit                           0x04aaedbd -[VKRasterOverlay setNeedsDisplayInRect:level:] + 157,
4   MapKit                              0x00999a8f -[MKOverlayRenderer setNeedsDisplayInMapRect:zoomScale:] + 111,
5   MapKit                              0x009a6b15 __50-[MKTileOverlayRenderer canDrawMapRect:zoomScale:]_block_invoke + 182,
6   MapKit                              0x009a3d70 __34-[MKTileOverlay _loadTile:result:]_block_invoke + 57,
7   GeoServices                         0x04e481d6 ___ZNK49-[GEOTileLoaderInternal _loadedTile:forKey:info:]66__49-[GEOTileLoaderInternal _loadedTile:forKey:info:]_block_invoke3$_1clERKN8LoadItem9RequesterE_block_invoke_2 + 85,
8   libdispatch.dylib                   0x02a7c7b8 _dispatch_call_block_and_release + 15,
9   libdispatch.dylib                   0x02a914d0 _dispatch_client_callout + 14,
10  libdispatch.dylib                   0x02a7f726 _dispatch_main_queue_callback_4CF + 340,
11  CoreFoundation                      0x0279a43e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14,
12  CoreFoundation                      0x026db5cb __CFRunLoopRun + 1963,
13  CoreFoundation                      0x026da9d3 CFRunLoopRunSpecific + 467,
14  CoreFoundation                      0x026da7eb CFRunLoopRunInMode + 123,
15  GraphicsServices                    0x0389f5ee GSEventRunModal + 192,
16  GraphicsServices                    0x0389f42b GSEventRun + 104,
17  UIKit                               0x015b9f9b UIApplicationMain + 1225,
18  MyApp                                 0x00073f2d main + 141,
19  libdyld.dylib                       0x02cc6701 start + 1
)

Configuration:
iPhone 5 using Network Link Conditioner with Edge profile

Comments

Filed reference radar: 17977737

By alexander.rupsch at Aug. 19, 2014, 9:38 p.m. (reply...)

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!