Re: Another NSDocument question
Re: Another NSDocument question
- Subject: Re: Another NSDocument question
- From: John Stiles <email@hidden>
- Date: Tue, 26 Jul 2005 20:59:54 -0700
I actually originally moved my freeing code from -dealloc to -close:
because I saw in the debugger that -dealloc wasn't being called.
Now I highly suspect that the reason -dealloc wasn't being called was
because -close: wasn't calling [super close].
Heh. Now it all makes sense :) Thanks again for all your help. I'm
sure I'll have more questions tomorrow.
On Jul 26, 2005, at 8:56 PM, Michael McCracken wrote:
Yes, you do need [super close] - that's probably what's making the
document controller not register your document having been closed.
The call to super's close is what will eventually deallocate your
object.
If you are just using -close to release instance variables and close
file handles, the standard thing is to do that in -dealloc instead,
and not mess with -close, unless there's really something that has to
be done before the AppKit code knows that your document will be
closing (unlikely).
HTH,
-mike
On 7/26/05, John Stiles <email@hidden> wrote:
I do have a custom -close: message in the MyDocument class which I
use to free all my objects and close file handles, etc.
Do I have to do anything specific in there? I was thinking on my way
home maybe I need to do [super close] to propagate the message up the
chain. But I don't really know if that will help or not, and I can't
test it until tomorrow when I'm back at work.
On Jul 26, 2005, at 7:24 PM, Michael McCracken wrote:
No, this isn't a common problem. Are you doing anything custom with
the closing?
Maybe you should check to be sure that the document itself is being
closed and deallocated, because if the NSDocument instance is still
around even though its windows are closed, the document controller
might think it doesn't have anything to do.
-mike
On 7/26/05, John Stiles <email@hidden> wrote:
I've found that my NSDocument app will refuse to open the same
document twice in one sitting. If I quit and reopen, everything's
fine; if I open unique documents each time, no problem. But
opening a
document, closing it, and then reopening it is no good. I don't get
an error; my readFromFile method just isn't called.
Is this a common problem? What might be causing it?
Thanks again for your help, everyone :)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
--
Michael McCracken
UCSD CSE PhD Candidate
research: http://www.cse.ucsd.edu/~mmccrack/
misc: http://michael-mccracken.net/blog/
--
Michael McCracken
UCSD CSE PhD Candidate
research: http://www.cse.ucsd.edu/~mmccrack/
misc: http://michael-mccracken.net/blog/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden