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 PROTECTED]
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to