Re: how do I save prefs when the app is Force Quit?
Re: how do I save prefs when the app is Force Quit?
- Subject: Re: how do I save prefs when the app is Force Quit?
- From: Steve Checkoway <email@hidden>
- Date: Sun, 14 May 2006 12:48:25 -0700
On May 14, 2006, at 11:50 AM, Alexander Dymerets wrote:
Alan Smith wrote:
I need to save prefs but want it to be done even if the app is force
quit. Does anyone know how?
void catch_term(int sig_num)
{
if (sig_num!=SIGTERM) return;
[myPreferences save];
exit(0);
}
int main(int argc, const char *argv[])
{
signal(SIGTERM, catch_term);
return NSApplicationMain(argc, argv);
}
This is wrong. Signal handlers can only call a very specific set of
functions. Check the sigaction(2) man page. In particular no
objective-c calls and no exit(3) as that might call atexit handlers.
- Steve
_______________________________________________
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