NSApplication terminate: behavior
NSApplication terminate: behavior
- Subject: NSApplication terminate: behavior
- From: Andreas Färber <email@hidden>
- Date: Fri, 20 Jan 2006 02:26:40 +0100
Hello,
I have noticed that NSApplication's run method does not return and call
exit() instead. Posts on this list and other places suggest to do
cleanup in applicationWillTerminate: or an atexit()-registered callback
function. However this does not do what I want it to...
The native Objective-C run method is being called from a managed
context and the ObjC runtime / AppKit framework exiting the app does
not let Garbage Collection happen for the managed context. If from a
managed context I just call the CLR exit() equivalent
System.Environment.Exit(0), it does a GC run but does not return to my
Main method either, and the menu item stays selected and my window
visible for some seconds after the application is Exit'ed.
Calling stop: from applicationShouldTerminate: returning ...Cancel
returns from run to Main but just as Exit() the Cocoa termination
cleanup is not performed correctly.
And when I throw an Exception in the atexit handler it does not go back
through the callstack, probably because all native instances are
already dealloc'ed...
So is there some geeky way to write a run equivalent that does not exit
but instead return? What does terminate: do exactly anyway apart from
calling the delegates? Any docs on that part?
Best regards,
Andreas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden