• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how do I save prefs when the app is Force Quit?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >how do I save prefs when the app is Force Quit? (From: "Alan Smith" <email@hidden>)
 >Re: how do I save prefs when the app is Force Quit? (From: Alexander Dymerets <email@hidden>)

  • Prev by Date: Re: Building binaries for PowerPC and Intel
  • Next by Date: Re: Undefined symbols error in deployment build
  • Previous by thread: Re: how do I save prefs when the app is Force Quit?
  • Next by thread: Re: how do I save prefs when the app is Force Quit?
  • Index(es):
    • Date
    • Thread