• 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
Window close
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Window close


  • Subject: Window close
  • From: Edward Fink <email@hidden>
  • Date: Thu, 3 Oct 2002 13:08:44 -0400

Is there any difference between using <command-w> vs. clicking on the "x" to close a window? Is there any difference in how messages are sent, the order, etc?

The reason I ask this is because I have a subclass of a window controller. This controller is also part of an NSMutableArray(in another class) as I *might* have a few of these when the app is running. Now when I use <command-w> to close the window, the "windowWillClose" delegate fires in my windowcontroller. When this happens I send a message to the class containing the NSMutableArray to remove the windowcontroller from the array. This will do a "release". Then at this point my retain count is still "1" for the windowcontroller...so I do a [self release] within the "windowWillClose". This works perfectly for me when I use <command-w>. However, if I actually "click on the X" to close the window...the app crashes. Now to fix this I have changed [self release] to [self autorelease]. That fixes my problem....however I do not understand why?

Any ideas?
_______________________________________________
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: Window close
      • From: Bill Cheeseman <email@hidden>
  • Prev by Date: Re: Embedding a scripting language into Cocoa app
  • Next by Date: Re: Menu items that reflect the document status
  • Previous by thread: Re: Embedding a scripting language into Cocoa app
  • Next by thread: Re: Window close
  • Index(es):
    • Date
    • Thread