I need to perform some cleanup operations in my NSDocument
subclass when documents are closed.
With the current implementation having that cleanup code in canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:
it only gets called when the document has any unsaved changed.
Even the close
method doesn't look like a good place - according to the docs This method may not always be called.
Is there one place to put that kind of code that's always called before a NSDocument
instance is destructed..?
There's some really neat message flow diagrams for initializing, opening and saving NSDocuments
in the docs - alas none for closing documents or quitting the app?!