Why setting object that is undergoing deallocation to weak property results in crash
In Clang's Objective-C Automatic Reference Counting we see the following For __weak objects, the lvalue is updated to point to the new pointee, unless the new pointee is an object currently undergoing deallocation, in which case the lvalue is updated to a null pointer. This must execute atomically with respect to other assignments to the object, to reads from the object, and to the final release of the new pointee. In objc-weak.mm wee see the following chunk of code in weak_register_no_lock() : if (deallocating) { if (crashIfDeallocating) { _objc_fatal("Cannot form weak reference to instance (