AppController dealloc is never called. Why?

2010-01-12 Thread Alexander Bokovikov

Hi, All,

Perhaps my question is stupid, but this is my first Cocoa project, so  
I'll try to ask. I've noticed that my main window controller (usually  
named AppController) is never freed. I don't know where it is  
allocated, but suppose it happens somewhere within NSApplication. All  
other windows, used in the program, are freed OK, as I'm doing it  
explicitly, as well as their initialization.


On the other hand, I'm getting BAD_ACCESS exception, if I insert [self  
release] within applicationWillTerminate delegate method of my  
AppController. So, what is the correct way to free AppController?


Thanks,
Alexander
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AppController dealloc is never called. Why?

2010-01-12 Thread Nick Zitzmann

On Jan 12, 2010, at 9:55 PM, Alexander Bokovikov wrote:

 On the other hand, I'm getting BAD_ACCESS exception, if I insert [self 
 release] within applicationWillTerminate delegate method of my AppController. 
 So, what is the correct way to free AppController?

Don't worry about it. When the task exits, the memory it used is reclaimed by 
the OS. If your application needs to do something else besides free memory when 
it terminates, then you must do that in -applicationWillTerminate: and not the 
-dealloc method of the application controller.

Nick Zitzmann
http://www.chronosnet.com/



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com