MKMapView crashes if released to early / in the wrong moment

  • Hi list.

    MKMapView is crashing on 3.x if you release it too early, when any of its animations are still in progress.
    (rdar://7408284)

    I had crashes in
    #1  0x32d209c0 in -[MKDotBounceAnimation animationDidStop:finished:] ()
    #1  0x0226f34e in typeinfo name for MKTileRequester ()
    #1  0x314b986a in -[MKMapView overlayView:viewForAnnotation:] ()
    #1  0x31509214 in -[MKUserLocationViewInternal userLocationViewAccuracyDidUpdate] ()

    All of these are fired by timers:
    #0  0x32668ec0 in objc_msgSend ()
    #1  0x32d209c0 in -[MKDotBounceAnimation animationDidStop:finished:] ()
    #2  0x33e99064 in run_animation_callbacks ()
    #3  0x33e98e6c in CA::timer_callback ()
    #4  0x32da44c2 in CFRunLoopRunSpecific ()
    #5  0x32da3c1e in CFRunLoopRunInMode ()
    #6  0x31bb9374 in GSEventRunModal ()
    #7  0x30bf3c30 in -[UIApplication _run] ()
    #8  0x30bf2230 in UIApplicationMain ()

    #0  0x979abedb in objc_msgSend ()
    #1  0x0226f34e in typeinfo name for MKTileRequester ()
    #2  0x03b0581b in run_animation_callbacks ()
    #3  0x03b055f5 in CA::timer_callback ()
    #4  0x0246eac0 in CFRunLoopRunSpecific ()
    #5  0x0246dc48 in CFRunLoopRunInMode ()
    #6  0x02b34615 in GSEventRunModal ()
    #7  0x02b346da in GSEventRun ()
    #8  0x00497faf in UIApplicationMain ()

    #0  0x33477700 in objc_msgSend ()
    #1  0x314b986a in -[MKMapView overlayView:viewForAnnotation:] ()
    #2  0x314dd9ae in -[MKOverlayView _addViewForAnnotation:] ()
    #3  0x314da43a in -[MKOverlayView _addViewsForAnnotations:animated:] ()
    #4  0x314d7410 in -[MKOverlayView showAddedAnnotationsAnimated:] ()
    #5  0x314ba336 in -[MKMapView _showAddedAnnotationsAndRouteAnimated:] ()
    #6  0x314c225c in -[MKMapView levelView:didLoadTile:] ()
    #7  0x314b40e2 in -[MKMapLevelView updateTileAfterReceivingContentForTile:] ()
    #8  0x314b3b6a in -[MKMapLevelView tileRequesterReceivedImage:forTile:] ()
    #9  0x314b6836 in -[MKMapLevelView tileRequesterProgress:] ()
    #10 0x314c886e in MKTileRequester::requestProgress ()
    #11 0x313f50c6 in coalesceTimerFired ()
    #12 0x3358abb2 in CFRunLoopRunSpecific ()
    #13 0x3358a35c in CFRunLoopRunInMode ()
    #14 0x3352bb32 in GSEventRunModal ()
    #15 0x3352bbde in GSEventRun ()
    #16 0x31c1976e in -[UIApplication _run] ()
    #17 0x31c18472 in UIApplicationMain ()

    #0  0x334776f6 in objc_msgSend ()
    #1  0x31509214 in -[MKUserLocationViewInternal userLocationViewAccuracyDidUpdate] ()
    #2  0x31505772 in -[MKUserLocationPositionAnimation animationDidStop:finished:] ()
    #3  0x30045a2c in run_animation_callbacks ()
    #4  0x300458e2 in CA::timer_callback ()
    #5  0x3358abb2 in CFRunLoopRunSpecific ()
    #6  0x3358a35c in CFRunLoopRunInMode ()
    #7  0x3352bb32 in GSEventRunModal ()
    #8  0x3352bbde in GSEventRun ()
    #9  0x31c1976e in -[UIApplication _run] ()
    #10 0x31c18472 in UIApplicationMain ()

    MKMapView seems to forget to stop all timers when it receives dealloc.

    I use MKMapView in my detail controllers. When the user moves back to the parent controller at the wrong moment (while the map view still does some animations) and my detail controller gets dealloced (and therefore the map view) the app crashes.
    Demo project at http://www.0as.de/stuff/MKMapBug7408284.zip
    Crashes in simulator on 3 and 5 seconds. Crashes the phone as well.

    Now I need a fix for 3.x. I could retain the map view for ever. Or keep it in memory for the next 20 seconds.
    Maybe someone has a better fix?

    atze
previous month april 2010 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today