• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Another NSDocument question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another NSDocument question


  • Subject: Re: Another NSDocument question
  • From: John Stiles <email@hidden>
  • Date: Wed, 27 Jul 2005 10:33:26 -0700

Adding a [super close] was in fact the solution.
Now I will move everything to -dealloc and get rid of my -close: entirely. Thanks!



John Stiles wrote:

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

_______________________________________________ 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
References: 
 >Another NSDocument question (From: John Stiles <email@hidden>)
 >Re: Another NSDocument question (From: Michael McCracken <email@hidden>)
 >Re: Another NSDocument question (From: John Stiles <email@hidden>)
 >Re: Another NSDocument question (From: Michael McCracken <email@hidden>)
 >Re: Another NSDocument question (From: John Stiles <email@hidden>)

  • Prev by Date: Re: Disposing of a Nib file
  • Next by Date: Re: Composite values using Core Data and Cocoa Bindings
  • Previous by thread: Re: Another NSDocument question
  • Next by thread: NSTableView and Custom Highlight Functions
  • Index(es):
    • Date
    • Thread