diff --git a/ChangeLog b/ChangeLog index 54967b42..a0278c09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,14 @@ -2004-08-06 07:20 Gregory John Casamento +2004-08-08 13:23 Gregory John Casamento + + * GormDocument.[hm]: Added ivar isDocumentOpened + to track when document is opened and closed. + The document was being made active while closing and was + causing an issue with some of the windows in the document + being edited being brought to the front even though the + document itself had been deallocated. This is the + permanent fix for the previously discovered issue. + +2004-08-07 06:10 Gregory John Casamento * GormObjectEditor.m: Temporary fix for recently discovered crash. diff --git a/GormDocument.h b/GormDocument.h index 643228ab..b3d225ea 100644 --- a/GormDocument.h +++ b/GormDocument.h @@ -51,7 +51,6 @@ NSString *documentPath; NSMapTable *objToName; NSWindow *window; - // NSMatrix *selectionView; NSBox *selectionBox; NSScrollView *scrollView; NSScrollView *classesScrollView; @@ -63,6 +62,7 @@ id imagesView; BOOL hasSetDefaults; BOOL isActive; + BOOL isDocumentOpen; NSMenu *savedMenu; NSMenuItem *quitItem; /* Replaced during test */ NSMutableArray *savedEditors; diff --git a/GormDocument.m b/GormDocument.m index 8619b81f..ac71076a 100644 --- a/GormDocument.m +++ b/GormDocument.m @@ -410,6 +410,8 @@ static NSImage *fileImage = nil; // are we upgrading an archive? isOlderArchive = NO; + // document is open... + isDocumentOpen = YES; } else { @@ -1061,6 +1063,9 @@ static NSImage *fileImage = nil; // Get rid of the selection box. [selectionBox removeFromSuperviewWithoutNeedingDisplay]; + // remove objects from the topLevelObjects set... + // [topLevelObjects removeAllObjects]; + // release the managers... RELEASE(classManager); RELEASE(filePrefsManager); @@ -2196,6 +2201,9 @@ static NSImage *fileImage = nil; [nc postNotificationName: IBDidOpenDocumentNotification object: self]; + // document opened... + isDocumentOpen = YES; + // release the unarchiver.. now that we're all done... RELEASE(u); } @@ -3062,7 +3070,7 @@ static NSImage *fileImage = nil; - (void) setDocumentActive: (BOOL)flag { - if (flag != isActive) + if (flag != isActive && isDocumentOpen) { NSEnumerator *enumerator; id obj; @@ -3254,12 +3262,23 @@ static NSImage *fileImage = nil; { //Save if (! [self saveGormDocument: self] ) - return NO; + { + return NO; + } + else + { + isDocumentOpen = NO; + } } - - //Cancel else if (result == NSAlertOtherReturn) - return NO; + { + //Cancel + return NO; + } + else // Don't save... + { + isDocumentOpen = NO; + } } return YES; diff --git a/Palettes/1Windows/GormNSWindow.m b/Palettes/1Windows/GormNSWindow.m index 22068585..698a1852 100644 --- a/Palettes/1Windows/GormNSWindow.m +++ b/Palettes/1Windows/GormNSWindow.m @@ -70,6 +70,11 @@ return NO; } +- (BOOL) canBecomeKeyWindow +{ + return NO; +} + - (NSString *) className { return @"NSWindow"; @@ -98,11 +103,35 @@ NSLog(@"Being released... %d: %@", [self retainCount], self); [super release]; } +*/ - (void) dealloc { NSLog(@"Deallocing %@",self); [super dealloc]; } -*/ + +- (void) orderFront: (id)sender +{ + NSLog(@"Ordering front...%@",self); + [super orderFront: sender]; +} + +- (void) orderFrontRegardless +{ + NSLog(@"Ordering front regardless...%@",self); + [super orderFrontRegardless]; +} + +- (void) orderWindow: (NSWindowOrderingMode)place relativeTo: (int)otherWin +{ + // NSLog(@"Ordering window %@",self); + [super orderWindow: place relativeTo: otherWin]; +} + +- (void) orderOut: (id)sender +{ + NSLog(@"Ordering out...%@",self); + [super orderOut: sender]; +} @end