• 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: cmd-q versus menu item quit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cmd-q versus menu item quit


  • Subject: Re: cmd-q versus menu item quit
  • From: Nick Zitzmann <email@hidden>
  • Date: Tue, 11 May 2004 15:41:33 -0600

On May 11, 2004, at 2:39 PM, Milton Sagen wrote:

The simplest explanation is to say that I have a temporary file that an object in the window deletes when its dealloc'd. The object is dealloc'd when the user quits with the cmd-q but not when quitting via the menu item, hence in the former case the file is removed but not in the latter.

Stiphane is correct; in general -dealloc methods should just release any member objects and disconnect itself from the rest of the application (if it observes notifications, etc.). Instead of doing what you're doing, you ought to make your object(s) listen for NSApplicationWillTerminateNotification and then do the cleanup in the observer for that notification.

Likewise, if this event is also supposed to trigger when a window is closed, then you ought to give your window a delegate and implement NSWindow's -windowWillClose: delegate.

Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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: cmd-q versus menu item quit
      • From: "b.bum" <email@hidden>
References: 
 >Re: cmd-q versus menu item quit (From: Milton Sagen <email@hidden>)

  • Prev by Date: Re: Resizing windows *and childs* with animate: YES
  • Next by Date: Re: NSView and backgrounds, selectable
  • Previous by thread: Re: cmd-q versus menu item quit
  • Next by thread: Re: cmd-q versus menu item quit
  • Index(es):
    • Date
    • Thread