title: iOS app sometimes crashes when dereferencing weak reference
body: <p>I have a very simple class:</p>
  
  <pre><code>@interface WORef : NSObject
  @property(nonatomic,weak) NSObject * object;
  @end
  </code></pre>
  
  <p>Instances are stored in an NSArray and from time to time (only on the main thread) this array is iterated and I access the "object" property.</p>
  
  <p>All works fine when testing or debugging, but in the production version of my app on the store I sometimes get crash reports when dereferencing the "object" property (the stack trace actually shows the line number of the property definition).</p>
  
  <p>Here is an example of such a call stack:</p>
  
  <pre><code>Thread : Crashed: com.apple.main-thread
  0  libsystem_platform.dylib       0x35180518 _os_lock_recursive_abort + 18446744073709552000
  1  libsystem_platform.dylib       0x3518050f _os_lock_handoff_lock_slow + 90
  2  libobjc.A.dylib                0x34adac3f objc_object::sidetable_release_slow((anonymous namespace)::SideTable*, bool) + 22
  3  libobjc.A.dylib                0x34adad2f objc_object::sidetable_release(bool) + 118
  4  Foundation                     0x27f56f01 -[NSOperationQueue dealloc] + 72
  5  libobjc.A.dylib                0x34adad5f objc_object::sidetable_release(bool) + 166
  6  libobjc.A.dylib                0x34ac14d9 _class_initialize + 536
  7  libobjc.A.dylib                0x34ac705f lookUpImpOrForward + 254
  8  libobjc.A.dylib                0x34ac6f1b lookUpImpOrNil + 26
  9  libobjc.A.dylib                0x34abfab3 class_getMethodImplementation + 34
  10 libobjc.A.dylib                0x34ada583 weak_read_no_lock + 58
  11 libobjc.A.dylib                0x34ada871 objc_loadWeakRetained + 92
  12 MyApp                          0x000c5983 -[WORef object] (WeakRef.m:12)
  </code></pre>
  
  <p>Anyone know what might be causing this?</p>