Hi all, 

I'm facing a problem returning NSTerminateLater from 
applicationShouldTerminate: in a status item application...
I've tried many things and followed the doc I've found, but nothing works as 
I'm expecting it to.

In short, I want to delay the termination of my status item application (which 
has LSUIElement set to YES if that matters) so that I can clean some things up 
before exiting.

It does work when I quit the application manually from the menu, but not at all 
when I'm restarting the computer. I've seen Terminal and other apps block the 
restart process to ask the user to confirm termination, so I guess what I want 
is feasible. I'm just probably missing some details...

Here's what I do :

in applicationShouldTerminate: I display a dialog using NSRunPanel. Depending 
on user choice, I either return NSTerminateNow or NSTerminateLater.
When I return NSTerminateLater I initiate my clean up process, which makes some 
asynchronous calls to a device driver. When I receive the driver's response, I 
call [NSApp replyToApplicationShouldTerminate:YES].
The entire process works perfectly fine when the app is being exited from the 
status item menu. If I do " > Restart" though, the AlertPanel shows (sometimes 
it doesn't even have the time to show up) but the system continues exiting and 
I don't have time to click anything.

I've tried always returning NSTerminateLater, and then display the Alter Panel, 
but it doesn't change anything.

So what am I doing wrong? Is there a requirement I don't meet? Does it have to 
be a document-based application?

Also, would you have any clever way to debug that kind of situation? Tried 
remote debugging but the connection would just be shut on restart...

Thanks a lot,
Olivier Lance._______________________________________________

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

Reply via email to