Reverted autorelease pool code

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@7785 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
nico 2000-10-11 09:58:36 +00:00
parent 25517feb5e
commit a79bfd9b30

View file

@ -273,8 +273,8 @@ static NSCell* tileCell = nil;
*/ */
gnustep_gui_app_is_in_dealloc = NO; gnustep_gui_app_is_in_dealloc = NO;
// Set the AppKit exception handler. // Set the AppKit exception handler.
_NSUncaughtExceptionHandler = _NSAppKitUncaughtExceptionHandler; _NSUncaughtExceptionHandler = _NSAppKitUncaughtExceptionHandler;
} }
} }
@ -562,16 +562,16 @@ static NSCell* tileCell = nil;
_inactive = [[NSMutableArray alloc] init]; _inactive = [[NSMutableArray alloc] init];
unhide_on_activation = YES; unhide_on_activation = YES;
app_is_hidden = YES; app_is_hidden = YES;
/* Ivar already automatically initialized to NO when the app is created */
//app_is_active = NO; //app_is_active = NO;
listener = [GSServicesManager newWithApplication: self]; listener = [GSServicesManager newWithApplication: self];
//main_menu = nil; //main_menu = nil;
windows_need_update = YES; windows_need_update = YES;
/* We shouldn't be so generous, NSEvent doesn't use -init */ /* NSEvent doesn't use -init so we use +alloc instead of +new */
current_event = [NSEvent alloc]; // no current event
current_event = [NSEvent alloc]; // no current event null_event = [NSEvent alloc]; // create dummy event
null_event = [NSEvent alloc]; // create dummy event
/* We are the end of responder chain */ /* We are the end of responder chain */
[self setNextResponder: nil]; [self setNextResponder: nil];
@ -881,14 +881,13 @@ static NSCell* tileCell = nil;
- (void) run - (void) run
{ {
NSEvent *e; NSEvent *e;
//Class arpClass = [NSAutoreleasePool class]; /* Cache the class */ Class arpClass = [NSAutoreleasePool class]; /* Cache the class */
NSAutoreleasePool *pool = nil; NSAutoreleasePool *pool;
id distantFuture = [NSDate distantFuture]; /* Cache this, safe */ id distantFuture = [NSDate distantFuture]; /* Cache this, safe */
NSDebugLog(@"NSApplication -run\n"); NSDebugLog(@"NSApplication -run\n");
RECREATE_AUTORELEASE_POOL(pool); pool = [arpClass new];
/* /*
* Set this flag here in case the application is actually terminated * Set this flag here in case the application is actually terminated
* inside -finishLaunching. * inside -finishLaunching.
@ -902,11 +901,11 @@ static NSCell* tileCell = nil;
[listener updateServicesMenu]; [listener updateServicesMenu];
[main_menu update]; [main_menu update];
DESTROY(pool); RELEASE (pool);
while (app_should_quit == NO) while (app_should_quit == NO)
{ {
RECREATE_AUTORELEASE_POOL(pool); pool = [arpClass new];
e = [self nextEventMatchingMask: NSAnyEventMask e = [self nextEventMatchingMask: NSAnyEventMask
untilDate: distantFuture untilDate: distantFuture
@ -932,7 +931,7 @@ static NSCell* tileCell = nil;
[self updateWindows]; [self updateWindows];
} }
DESTROY(pool); RELEASE (pool);
} }
[GSCurrentContext() destroyContext]; [GSCurrentContext() destroyContext];
@ -1069,20 +1068,20 @@ static NSCell* tileCell = nil;
- (int) runModalSession: (NSModalSession)theSession - (int) runModalSession: (NSModalSession)theSession
{ {
NSAutoreleasePool *pool = nil; Class arpClass = [NSAutoreleasePool class]; /* Cache the class */
NSAutoreleasePool *pool;
NSGraphicsContext *ctxt; NSGraphicsContext *ctxt;
BOOL found = NO; BOOL found = NO;
NSEvent *event; NSEvent *event;
NSDate *limit; NSDate *limit;
if (theSession != session) if (theSession != session)
{ {
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"runModalSession: with wrong session"]; format: @"runModalSession: with wrong session"];
} }
RECREATE_AUTORELEASE_POOL(pool); pool = [arpClass new];
[theSession->window orderFrontRegardless]; [theSession->window orderFrontRegardless];
if ([theSession->window canBecomeKeyWindow] == YES) if ([theSession->window canBecomeKeyWindow] == YES)
@ -1118,14 +1117,15 @@ static NSCell* tileCell = nil;
} }
while (found == NO && theSession->runState == NSRunContinuesResponse); while (found == NO && theSession->runState == NSRunContinuesResponse);
RELEASE (pool);
/* /*
* Deal with the events in the queue. * Deal with the events in the queue.
*/ */
DESTROY(pool);
RECREATE_AUTORELEASE_POOL(pool);
while (found == YES && theSession->runState == NSRunContinuesResponse) while (found == YES && theSession->runState == NSRunContinuesResponse)
{ {
pool = [arpClass new];
event = DPSGetEvent(ctxt, NSAnyEventMask, limit, NSDefaultRunLoopMode); event = DPSGetEvent(ctxt, NSAnyEventMask, limit, NSDefaultRunLoopMode);
if (event != nil) if (event != nil)
{ {
@ -1162,10 +1162,10 @@ static NSCell* tileCell = nil;
[self updateWindows]; [self updateWindows];
} }
} }
RELEASE (pool);
} }
NSAssert(session == theSession, @"Session was changed while running"); NSAssert(session == theSession, @"Session was changed while running");
RELEASE(pool);
return theSession->runState; return theSession->runState;
} }