Mocha
Mocha copied to clipboard
NSLocale.alloc() causes segmentation fault
Attempting to allocate an instance of NSLocale causes a segmentation fault, with a recursive loop in -alloc(). It appears that after -alloc() is evaluated, we attempt to retain the result, which NSLocale does not like.
This also affects NSCalendar, and possibly other classes. We should attempt to not retain the value in this case, or special case -alloc.
Should be fixed in 3dd6eb4.
This is once again an issue due to the switch to ARC. While we properly create the result of -alloc during the one-step alloc/init phase, ARC now performs an implicit objc_retain on the object in order to keep it alive in scope. This leads to the same issue we encountered before, as NSLocale and NSCalendar have a special (incorrect) implementation that impedes this behavior.