Window close
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.