mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Use an autoreleasepool during application termination to make sure
all resources are freed git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12684 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b964ba883e
commit
29f8db9d20
1 changed files with 12 additions and 5 deletions
|
@ -2228,20 +2228,24 @@ delegate.
|
|||
|
||||
if (shouldTerminate)
|
||||
{
|
||||
/* Use an autorelease pool, otherwise temporary objects created
|
||||
here would never be released, and might retain NSApp, and the
|
||||
DESTROY (NSApp) below would not deallocate it. */
|
||||
CREATE_AUTORELEASE_POOL (terminatePool);
|
||||
NSDictionary *userInfo;
|
||||
NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
|
||||
|
||||
[nc postNotificationName: NSApplicationWillTerminateNotification
|
||||
object: self];
|
||||
|
||||
|
||||
_app_is_running = NO;
|
||||
|
||||
[[self windows] makeObjectsPerformSelector: @selector(close)];
|
||||
|
||||
// Store our user information
|
||||
/* Store our user information. */
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
|
||||
// Tell the Workspace that we really did terminate
|
||||
/* Tell the Workspace that we really did terminate. */
|
||||
userInfo = [NSDictionary dictionaryWithObject:
|
||||
[[NSProcessInfo processInfo] processName] forKey:
|
||||
@"NSApplicationName"];
|
||||
|
@ -2249,9 +2253,12 @@ delegate.
|
|||
postNotificationName: NSWorkspaceDidTerminateApplicationNotification
|
||||
object: workspace
|
||||
userInfo: userInfo];
|
||||
// Free the memory of self
|
||||
DESTROY (terminatePool);
|
||||
|
||||
/* Free the memory of self. */
|
||||
DESTROY(NSApp);
|
||||
// and stop the program
|
||||
|
||||
/* And stop the program. */
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue