Mocha icon indicating copy to clipboard operation
Mocha copied to clipboard

NSLocale.alloc() causes segmentation fault

Open logancollins opened this issue 12 years ago • 2 comments

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.

logancollins avatar Jul 25 '12 19:07 logancollins

Should be fixed in 3dd6eb4.

logancollins avatar Jul 25 '12 20:07 logancollins

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.

logancollins avatar Aug 08 '12 02:08 logancollins