Correction for crash seen by Banlu.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21163 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2005-04-28 12:50:50 +00:00
parent d9356d6300
commit e203f18136
2 changed files with 16 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2005-04-28 08:50 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocument.m: Correct problem in setName:forObject:
which was causing a segfault.
2005-04-24 11:16 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormClassManager.m: Remove special case for

View file

@ -2672,10 +2672,10 @@ static NSImage *fileImage = nil;
*/
- (void) setName: (NSString*)aName forObject: (id)object
{
id oldObject;
NSString *oldName;
id oldObject = nil;
NSString *oldName = nil;
NSMutableDictionary *cc = [classManager customClassMap];
NSString *className;
NSString *className = nil;
if (object == nil)
{
@ -2721,7 +2721,7 @@ static NSImage *fileImage = nil;
return; /* Already named ... nothing to do */
}
}
else
else // user supplied a name...
{
oldObject = [nameTable objectForKey: aName];
if (oldObject != nil)
@ -2746,6 +2746,7 @@ static NSImage *fileImage = nil;
NSMapInsert(objToName, (void*)object, (void*)aName);
if (oldName != nil)
{
RETAIN(oldName); // hold on to this temporarily...
[nameTable removeObjectForKey: oldName];
}
if ([objectsView containsObject: object] == YES)
@ -2764,6 +2765,12 @@ static NSImage *fileImage = nil;
[cc setObject: className forKey: aName];
}
}
// release oldName, if we get to this point.
if(oldName != nil)
{
RELEASE(oldName);
}
}
/**