On Sep 12, 2013, at 1:45 PM, Lee Ann Rucker <[email protected]> wrote: > On Sep 12, 2013, at 9:57 AM, Bill Cheeseman wrote: >> As I recall, it stated that the "return [[x retain] autorelease]" pattern is >> preferred for getters and gave many reasons for preferring it. > > Coincidentally enough, we've just hit a case where that's bad - it's a > complicated situation with ObjC++ and C++ object lifetimes, resulting in an > accessor that uses that pattern being called as a result of that object being > in dealloc. By the time the autorelease pool pops the object it's trying to > release is long gone. It's KVO unregistering, so there's not much we can do > about it other than be smarter in our accessors.
In some cases you can add an @autoreleasepool inside the object's -dealloc method to catch these. -- Greg Parker [email protected] Runtime Wrangler _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
