Re: Observing with GC
Re: Observing with GC
- Subject: Re: Observing with GC
- From: "Sean McBride" <email@hidden>
- Date: Tue, 26 Feb 2008 10:51:09 -0500
- Organization: Rogue Research
On 2/26/08 12:01 AM, Quincey Morris said:
>On Feb 25, 2008, at 21:08, Bill Bumgarner wrote:
>
>> In general, -finalize should not be used to manage scarce resource
>> nor muck around with the app's object graph, including tearing down
>> observations and the like.
>
>
>I find it hard to see anything dangerous in the finalize strategy used
>in the above code, unless:
Don't forget that -finalize methods must be thread-safe. Your example:
- (void) finalize {
if (observer)
[self removeObserver: observer forKeyPath: @"name"];
[super finalize];
}
Is removeObserver:forKeyPath: documented to be threadsafe? After a
quick search, I find it hard to tell.
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden