Re: Cleaning up a singleton

2008-05-24 Thread Sebastian Nowicki
On 24/05/2008, at 3:48 PM, Andreas Mayer wrote: In case you use the notification, there is no need to expose anything. You just register a method of your singleton to receive the NSApplicationWillTerminateNotification and do your cleanup there. On Apple's developer website there are severa

Re: Cleaning up a singleton

2008-05-24 Thread Andreas Mayer
Am 24.05.2008 um 09:28 Uhr schrieb Sebastian Nowicki: I can't be certain that the cleanup function won't do other things in the future, such as removing files (locks). If, for some other reason, you need to act when the application quits, you can register for the NSApplicationWillTermina

Re: Cleaning up a singleton

2008-05-24 Thread Sebastian Nowicki
On 24/05/2008, at 2:20 PM, Andreas Mayer wrote: Am 24.05.2008 um 08:07 Uhr schrieb Sebastian Nowicki: The library requires me to call a function which allocates memory to that global variable, and afterwards call a function which deallocates that memory. My singleton class calls the funct

Re: Cleaning up a singleton

2008-05-23 Thread Andreas Mayer
Am 24.05.2008 um 08:07 Uhr schrieb Sebastian Nowicki: The library requires me to call a function which allocates memory to that global variable, and afterwards call a function which deallocates that memory. My singleton class calls the function to initialise in the init method, but I don't

Re: Cleaning up a singleton

2008-05-23 Thread Andrew Merenbach
Hi, Would the following NSApplication methods, placed into your application delegate's code, help at all? - (void)applicationDidFinishLaunching:(NSNotification *)aNotification; - (void)applicationWillTerminate:(NSNotification *)aNotification; Of the latter, the docs say that one should "Put

Cleaning up a singleton

2008-05-23 Thread Sebastian Nowicki
Hi, I have a bit of an odd problem, which may be the result of a bad design decision. My program wraps around a C library, which internally uses a global variable (structure) to manage things, and has functions to access the data. The library requires me to call a function which allocates