UIGestureRecognizerFailureMap crash (failure map messaging zombies?)
| Originator: | golden | ||
| Number: | rdar://15827524 | Date Originated: | 15-Jan-2014 12:27 PM |
| Status: | Open | Resolved: | |
| Product: | iOS | Product Version: | 5.1.1 |
| Classification: | Crash | Reproducible: | Sometimes |
App crashes with a variety of stacks which all include "-[_UIGestureRecognizerFailureMap _queueRecognizersForResetIfFinished]". In every case it looks like this method is trying to message deallocated objects. Steps to Reproduce: It's unclear exactly how to reproduce the issue, but we've seen it a few times, always on first generation iPads, always around the time that view controllers managing UIWebViews were being deallocated. Expected Results: No crashes. Actual Results: Some crashes. Version: iOS 5.1.1 Configuration: I've seen the crash once and another developer on my team has seen it three times, always on a first generation iPad running iOS 5.1 and around the time that view controllers managing UIWebViews were being deallocated (and new ones were being allocated).
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!
Crash circumstances
Context: I work with golden. This crash appears to be caused by a failure of the gesture recognition runtime to immediately update the dependency map when gesture recognizers drop out of scope.
In our app, a gesture recognizer owned by a container view controller is dependent on gesture recognizers owned by a series of child view controllers. As child view controllers are removed from the container, their gesture recognizers are freed, while the container's recognizer remains alive. The gesture recognition runtime removes the invalid references from the dependency map--but not immediately. If the user touches upon the container view soon after a child view controller is unloaded, the runtime may try to message what are now dangling references to the child recognizers, causing the segfaults seen above.
This issue could be resolved by: having the gesture recognition dependency map update immediately after gesture recognizers are removed from their views; having the gesture recognition map use weak references to the gesture recognizers; or giving developers an API to remove dependencies registered using
-requireGestureRecognizerToFail:.Crash 3
Crash 2
Crash 1