Re: NSDocument reference held by NSSavePanel?
Re: NSDocument reference held by NSSavePanel?
- Subject: Re: NSDocument reference held by NSSavePanel?
- From: Michael Ash <email@hidden>
- Date: Mon, 13 Apr 2009 13:07:01 -0400
On Mon, Apr 13, 2009 at 12:34 PM, Quincey Morris
<email@hidden> wrote:
> On Apr 13, 2009, at 08:08, Michael Ash wrote:
>
>> Can you really withstand having that exclusive resource be occupied
>> for seconds after your document closes?
>
> Actually, in this case, yes.
>
>> If the GC decides not to
>> collect that object for a much longer period of time, say, six years,
>> which it is perfectly within its rights to do, does that work for you?
>
> Not six years. :)
>
> I appreciate your point, and admit your correctness, but in this case the
> timing is insignificant enough to permit me to be lazy and do the resource
> deallocation in -finalize. So, if there are any children watching: Don't do
> this at home. Do as Michael Ash says, not as I do. ;)
I'm confused. If you can't stand six years then you can't rely on
-finalize. Nothing guarantees that it will *ever* be called in a
timely fashion. If it's just a temporary hack that's "good enough" for
your purposes, then fine, but it's incorrect if you ever need to
access this mutually-exclusive resource again without restarting your
app.
Mike
_______________________________________________
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