On Sep 15, 2008, at 5:18 PM, Quincey Morris wrote:

On Sep 15, 2008, at 14:35, Ken Thomases wrote:

It's possible that it's not safe to release a NSOperation until after it returns YES to [NSOperation isFinished].

I don't think there needs to be anything specific in the documentation. In the absence of a documented exception, we should assume it follows the usual Cocoa memory management conventions. That is, if you need to continue to access the NSOperation, you need to hold ownership of it. If you don't care about accessing it in the future, you need not. The NSOperationQueue is expected to do whatever is necessary for it to carry out its responsibilities. If it needs to retain the NSOperation objects, and we can guess that it probably does need that, it will. You, as a client, shouldn't care though.

The question is not really about what NSOperationQueue does, but whether it's safe to release a NSOperation while it's executing. If not (as seems likely), then even if you don't otherwise care about accessing it in the future, you must not release it until 'isFinished' returns YES.

I think you mean "whether it's safe to _deallocate_ an NSOperation while it's executing". But again, Cocoa's memory management conventions don't put that onus on you, the client. If it's not safe, then it's the responsibility of either NSOperation or NSOperationQueue to protect against it, not yours. Your only responsibility is to express the period over which you need the object to stick around for your purposes.

If the client were to bear such responsibility, then _that_ would be an exception to the conventions, and that would have to be documented. In the absence of such documentation, the assumption is that the client doesn't bear that responsibility.

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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