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

Document won't close


  • Subject: Document won't close
  • From: Neil Earnshaw <email@hidden>
  • Date: Sat, 26 Jul 2003 14:17:03 +0100

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'.

I've overridden addWindowController: and removeWindowController:, so I can check that they're being called the right number of times, before passing the call on to super. So, I know the window controllers are being added and removed correctly. (Yes, I have set 'Release when closed' to true in IB.) I've also instrumented dealloc for the window controllers, so I know they are being properly deallocated after they are removed from the document's list of window controllers.

Nothing in my code retains the document. I'm using the default NSDocumentController - its the only thing that could retain my doc.

There's an extra twist to the problem. The app opens with a browser window. This opens a diagram window when a model element is created. If I close the diagram window, then the browser window, it functions correctly and the doc is deallocated. If I close the browser window, _then_ the diagram window, I'm prompted to save, but the doc isn't deallocated.

I've spent two days trying to figure this out, so any hints or suggestions would be gratefully appreciated.

Neil



Neil Earnshaw
Consultant Software Engineer
Object Software Engineers Ltd
email@hidden
Tel : 01747 854 852
Mbl : 07870 209 102
_______________________________________________
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.

  • Follow-Ups:
    • Re: Document won't close
      • From: James Quick <email@hidden>
  • Prev by Date: Re: A Weird Problem
  • Next by Date: Re: FYI: Bug in -getInfoForFile:application:type:
  • Previous by thread: Re: Getting rid of "hidden" fonts
  • Next by thread: Re: Document won't close
  • Index(es):
    • Date
    • Thread