mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-24 03:51:22 +00:00
Some additional memory management improvements.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@19302 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a840e3a7ee
commit
e58da6f7b8
6 changed files with 60 additions and 72 deletions
41
ChangeLog
41
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2004-05-13 18:47 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Gorm.m: Removed some commented out code. Removed commented out
|
||||
RELEASE statements, now that AUTORELEASE is used.
|
||||
* GormDocument.m: [GormDocument dealloc] added openEditors to the
|
||||
set of things released. [GormDocument editorForObject:create:] when
|
||||
a new editor is created, add it to the master list of editors. This
|
||||
makes it easier to send the close message to all of the editors upon
|
||||
shutdown. [GormDocument editor:dicCloseForObject:] removes the editor
|
||||
from the list of editors. [GormDocument _closeAllEditors] closes all
|
||||
of the editors in the document using the new list.
|
||||
* GormDocument.h: Added member variable openEditors.
|
||||
* Palettes/GormMenuEditor.m: Added category to allow testing when
|
||||
a menu is visible so that we can avoid sending the close message to
|
||||
it. This prevents the harmless message "Invalidparm: ordered invalid
|
||||
window 0" from appearing when the document is being closed.
|
||||
|
||||
2004-05-13 01:03 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
NOTE: These changes might unstabilize things a bit.
|
||||
|
@ -7,18 +24,20 @@
|
|||
* GormDocument.m: Addition of a method called
|
||||
[GormDocument _closeAllEditors] this closes all of the editors from
|
||||
the handleNotification method before the any objects are ultimately
|
||||
released. Removal of old, commented out GormFontManager implementation.
|
||||
Streamlined the dealloc method to make certain everything is released.
|
||||
Also changed the window in the init method so that it doesn't release itself
|
||||
when it's closed by the user. This allows for a more controlled shutdown.
|
||||
released. Removal of old, commented out GormFontManager
|
||||
implementation. Streamlined the dealloc method to make certain
|
||||
everything is released. Also changed the window in the init
|
||||
method so that it doesn't release itself when it's closed by
|
||||
the user. This allows for a more controlled shutdown.
|
||||
* GormDocument.h: Minor code cleanup.
|
||||
* GormGenericEditor.[hm]: Added activate, closed ivars. Also added code
|
||||
in close and activate to make use of them. Added code in dealloc to call
|
||||
[GormGenericEditor close] if there the flag indicates the editor is
|
||||
open. Also moved some common, trivial, operations to the parent class
|
||||
implementation of initWithObject:inDocument:.
|
||||
* GormObjectEditor.m: Added code in close to remove the document from the
|
||||
map. This eliminates a crash which was occurring.
|
||||
* GormGenericEditor.[hm]: Added activate, closed ivars. Also added
|
||||
code in close and activate to make use of them. Added code in
|
||||
dealloc to call [GormGenericEditor close] if there the flag
|
||||
indicates the editor is open. Also moved some common, trivial,
|
||||
operations to the parent class implementation of
|
||||
initWithObject:inDocument:.
|
||||
* GormObjectEditor.m: Added code in close to remove the document
|
||||
from the map. This eliminates a crash which was occurring.
|
||||
* GormSoundEditor.m: Same.
|
||||
* GormImageEditor.m: Same.
|
||||
* GormViewEditor.m: Re-arranged the initWithObject:inDocument:.
|
||||
|
|
21
Gorm.m
21
Gorm.m
|
@ -579,7 +579,6 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
|||
GormDocument *doc = AUTORELEASE([GormDocument new]);
|
||||
|
||||
[documents addObject: doc];
|
||||
// RELEASE(doc);
|
||||
if ([doc openDocument: sender] == nil)
|
||||
{
|
||||
[documents removeObjectIdenticalTo: doc];
|
||||
|
@ -587,24 +586,7 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
|||
}
|
||||
else
|
||||
{
|
||||
// NSDictionary *nameTable = [doc nameTable];
|
||||
// NSEnumerator *enumerator = [nameTable keyEnumerator];
|
||||
// NSString *key = nil;
|
||||
|
||||
// order everything front.
|
||||
[[doc window] makeKeyAndOrderFront: self];
|
||||
|
||||
/*
|
||||
// the load is completed, awaken all of the elements.
|
||||
while ((key = [enumerator nextObject]) != nil)
|
||||
{
|
||||
id o = [nameTable objectForKey: key];
|
||||
if ([o respondsToSelector: @selector(awakeFromDocument:)])
|
||||
{
|
||||
[o awakeFromDocument: doc];
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -614,7 +596,6 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
|||
{
|
||||
id doc = AUTORELEASE([GormDocument new]);
|
||||
[documents addObject: doc];
|
||||
// RELEASE(doc);
|
||||
switch ([sender tag])
|
||||
{
|
||||
case 0:
|
||||
|
@ -1138,7 +1119,6 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
|||
else if ([name isEqual: IBWillCloseDocumentNotification])
|
||||
{
|
||||
[documents removeObjectIdenticalTo: obj];
|
||||
// AUTORELEASE(obj); // let the document go, once everything is done...
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1192,7 +1172,6 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
|||
GormDocument *doc = AUTORELEASE([GormDocument new]);
|
||||
|
||||
[documents addObject: doc];
|
||||
// RELEASE(doc);
|
||||
if ([doc loadDocument: fileName] == nil)
|
||||
{
|
||||
[documents removeObjectIdenticalTo: doc];
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
NSMutableArray *hidden;
|
||||
NSMutableSet *sounds;
|
||||
NSMutableSet *images;
|
||||
// NSMutableArray *editors;
|
||||
NSMutableArray *openEditors;
|
||||
}
|
||||
- (void) addConnector: (id<IBConnectors>)aConnector;
|
||||
- (NSArray*) allConnectors;
|
||||
|
|
|
@ -762,6 +762,7 @@ static NSImage *classesImage = nil;
|
|||
RELEASE(savedEditors);
|
||||
RELEASE(scrollView);
|
||||
RELEASE(classesScrollView);
|
||||
RELEASE(openEditors);
|
||||
RELEASE(window);
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -1327,7 +1328,7 @@ static NSImage *classesImage = nil;
|
|||
/*
|
||||
* Add to the master list of editors for this document
|
||||
*/
|
||||
// [editors removeObjectIdenticalTo: anEditor];
|
||||
[openEditors removeObjectIdenticalTo: anEditor];
|
||||
|
||||
/*
|
||||
* Make sure that this editor is not the selection owner.
|
||||
|
@ -1371,13 +1372,10 @@ static NSImage *classesImage = nil;
|
|||
[link setDestination: editor];
|
||||
[connections addObject: link];
|
||||
|
||||
// add to the list...
|
||||
/*
|
||||
if(![editors containsObject: editor])
|
||||
if(![openEditors containsObject: editor])
|
||||
{
|
||||
[editors addObject: editor];
|
||||
[openEditors addObject: editor];
|
||||
}
|
||||
*/
|
||||
|
||||
RELEASE(link);
|
||||
if (anEditor == nil)
|
||||
|
@ -1463,20 +1461,13 @@ static NSImage *classesImage = nil;
|
|||
|
||||
- (void) _closeAllEditors
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
id con;
|
||||
|
||||
// close all editors attached to objects...
|
||||
enumerator = [connections objectEnumerator];
|
||||
while ((con = [enumerator nextObject]) != nil)
|
||||
{
|
||||
if ([con isKindOfClass: [GormObjectToEditor class]] == YES)
|
||||
{
|
||||
[[con destination] close];
|
||||
}
|
||||
}
|
||||
// close all of the editors & get all of the objects out.
|
||||
[openEditors makeObjectsPerformSelector: @selector(close)];
|
||||
[openEditors removeAllObjects];
|
||||
|
||||
// close the editors in the document window...
|
||||
// don't worry about the "classEditor" since it's not really an
|
||||
// editor.
|
||||
[objectsView close];
|
||||
[imagesView close];
|
||||
[soundsView close];
|
||||
|
@ -1518,8 +1509,7 @@ static NSImage *classesImage = nil;
|
|||
// deactivate the document...
|
||||
[self setDocumentActive: NO];
|
||||
[self setSelectionFromEditor: nil];
|
||||
[self _closeAllEditors];
|
||||
// [editors makeObjectsPerformSelector: @selector(close)]; // close all of the editors...
|
||||
[self _closeAllEditors]; // shut down all of the editors..
|
||||
[nc postNotificationName: IBWillCloseDocumentNotification
|
||||
object: self];
|
||||
[nc removeObserver: self]; // stop listening to all notifications.
|
||||
|
@ -1639,7 +1629,7 @@ static NSImage *classesImage = nil;
|
|||
alpha: 1.0 ];
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
// editors = [NSMutableArray new];
|
||||
openEditors = [NSMutableArray new];
|
||||
classManager = [[GormClassManager alloc] init];
|
||||
classEditor = [[GormClassEditor alloc] initWithDocument: self];
|
||||
|
||||
|
@ -1916,14 +1906,6 @@ static NSImage *classesImage = nil;
|
|||
[self parseHeader: (NSString *)obj];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// add editors here to the list...
|
||||
// [editors addObject: classEditor];
|
||||
[editors addObject: objectsView];
|
||||
[editors addObject: imagesView];
|
||||
[editors addObject: soundsView];
|
||||
*/
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -56,11 +56,19 @@
|
|||
@end
|
||||
|
||||
/*
|
||||
@interface NSButtonCell (GormObjectAdditions)
|
||||
- (NSRect) gormTitleRectForFrame: (NSRect) cellFrame
|
||||
inView: (NSView *)controlView;
|
||||
* This method will allow us to check if the menu is
|
||||
* open, so that it can be conditionally closed.
|
||||
*/
|
||||
@interface NSMenu (GormMenuEditorAdditions)
|
||||
- (BOOL) isVisible;
|
||||
@end
|
||||
|
||||
@implementation NSMenu (GormMenuEditorAdditions)
|
||||
- (BOOL) isVisible
|
||||
{
|
||||
return [_aWindow isVisible];
|
||||
}
|
||||
@end
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
@ -437,7 +445,6 @@
|
|||
isClosed = YES;
|
||||
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||
|
||||
[self makeSelectionVisible: NO];
|
||||
if ([(id<IB>)NSApp selectionOwner] == self)
|
||||
{
|
||||
[document resignSelectionForEditor: self];
|
||||
|
@ -445,6 +452,7 @@
|
|||
|
||||
[self closeSubeditors];
|
||||
[self deactivate];
|
||||
if([edited isVisible])
|
||||
[edited close];
|
||||
[document editor: self didCloseForObject: edited];
|
||||
}
|
||||
|
@ -498,7 +506,7 @@
|
|||
{
|
||||
[self close];
|
||||
}
|
||||
// RELEASE(edited);
|
||||
|
||||
RELEASE(selection);
|
||||
RELEASE(subeditor);
|
||||
[super dealloc];
|
||||
|
|
|
@ -139,7 +139,7 @@
|
|||
// This method is purely for debugging purposes...
|
||||
- (void) display
|
||||
{
|
||||
NSLog(@"In GormNSMenu display...");
|
||||
NSDebugLog(@"In GormNSMenu display...");
|
||||
[super display];
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue