title: ios App crashes when deallocating an UIView subclass instance
body: <p>My app built natively with CocoaTouch and ARC crashes when deallocating a UIView subclass instance.</p>
  
  <p>Here is the crash log.</p>
  
  <pre><code>OS Version:      iOS 6.1.3 (10B329)
  
  Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
  Exception Codes: KERN_INVALID_ADDRESS at 0x00000008
  Crashed Thread:  0
  
  0: 0x39de65b0 libobjc.A.dylib objc_msgSend + 16
  1: 0x31edb694 CoreFoundation -[NSArray makeObjectsPerformSelector:] + 300
  2: 0x33d8c57a UIKit -[UIView(UIViewGestures) removeAllGestureRecognizers] + 146
  3: 0x33d8c144 UIKit -[UIView dealloc] + 440
  4: 0x00240b36 MyApp -[StandardPanelView .cxx_destruct](self=0x20acba30, _cmd=0x00240985) + 434 at StandardPanelView.m:139
  5: 0x39deaf3c libobjc.A.dylib object_cxxDestructFromClass(objc_object*, objc_class*) + 56
  6: 0x39de80d2 libobjc.A.dylib objc_destructInstance + 34
  7: 0x39de83a6 libobjc.A.dylib object_dispose + 14
  8: 0x33d8c26a UIKit -[UIView dealloc] + 734
  9: 0x0022aa14 MyApp -[StandardPanelView dealloc](self=0x20acba30, _cmd=0x379f1a66) + 156 at StandardPanelView.m:205
  10: 0x39de8488 libobjc.A.dylib (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 168
  11: 0x31e98440 CoreFoundation _CFAutoreleasePoolPop + 16
  12: 0x31f28f40 CoreFoundation __CFRunLoopRun + 1296
  13: 0x31e9bebc CoreFoundation CFRunLoopRunSpecific + 356
  14: 0x31e9bd48 CoreFoundation CFRunLoopRunInMode + 104
  15: 0x35a502ea GraphicsServices GSEventRunModal + 74
  16: 0x33db1300 UIKit UIApplicationMain + 1120
  17: 0x00113c50 MyApp main(argc=1, argv=0x2fd3ed30) + 140 at main.m:23
  </code></pre>
  
  <p>The questions are:</p>
  
  <ol>
  <li>what could be set wrong that makes the internal call to [UIView(UIViewGestures) removeAllGestureRecognizers] crash. One theory is that some gesture in the gestures array is deallocated already somewhere else.</li>
  <li>When a UIView contains subviews, how is the sequence of deallocation process?</li>
  </ol>
  
  <p>Some extra background info:</p>
  
  <ol>
  <li>The crash happens, but there is no exact way to reproduce it.</li>
  <li>The StandardPanelView instance works as delegate for gestures belongs to its subviews.</li>
  <li>We are using flyweight on StandardPanelView instances, i.e., caching and recycling.</li>
  </ol>
  
  <p>Thanks in advance for any hint about how this crash could happen.</p>