• 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: Document won't close
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Document won't close


  • Subject: Re: Document won't close
  • From: James Quick <email@hidden>
  • Date: Sat, 26 Jul 2003 12:23:30 -0400

On Saturday, July 26, 2003, at 09:17 AM, Neil Earnshaw wrote:

Why would my document class fail to close when all its window controllers have been removed?

My document has a hierarchical model. Elements of the model can be viewed as trees in a browser window, or as graphs in a drawing window. These window types can be opened on the contents of the model at any level and you can have more than one open on a dingle model element.

When the last window has closed, I'm prompted to save changes. If i save them, then the document is deallocated. If I hit 'Don't Save', then the window closes but the document doesn't deallocate. When I quit the app, this zombie doc asks me again if I want to save. The app then quits if I hit 'Don't Save'.

Look at - (void)removeDocument:(NSDocument *)document, in the DocumentController.
A document is supposed to send this to its controller when it closes.

It looks like the above method is never getting called in the Controller because Your document's
superclass is never receiving - close.

In the method you are doing your save and cleanup are you calling close?
If you are logically closing I think this has to be invoked along the way, or the
Controller won't know about it.

If their is some other route via super's built in logic for close to be invoked autmoatically
I would suggest looking at the return value of the method you iomplemented for saving.
If your Document subclass is overriding a variant of writeToFile:ofType: are you returning
TRUE/YES when you choose not save? That might cause your controller to think you are
still a live document, and not arrange for you to get sent close.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Document won't close (From: Neil Earnshaw <email@hidden>)

  • Prev by Date: Broken pipe in NSTask I/O
  • Next by Date: Re: Localizing a project
  • Previous by thread: Document won't close
  • Next by thread: was: accessing data from within a class
  • Index(es):
    • Date
    • Thread