Better copying

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6406 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2000-03-31 22:54:44 +00:00
parent 41b7ca405d
commit aef56c9336
3 changed files with 13 additions and 7 deletions

View file

@ -2,6 +2,7 @@
* Headers/gnustep/gui/NSFont.h: Conform to NSCopying.
* Source/NSFont.m ([NSFont -copyWithZone:]): Implement.
* Source/GSFontInfo.m: (-copyWithZone:): Likewise
2000-03-31 Jonathan Gapen <jagapen@whitewater.chem.wisc.edu>

View file

@ -50,7 +50,7 @@
- (NSArray*) availableMembersOfFontFamily: (NSString*)family;
@end
@interface GSFontInfo : NSObject
@interface GSFontInfo : NSObject <NSCopying>
{
NSMutableDictionary* fontDictionary;

View file

@ -182,12 +182,17 @@ static GSFontEnumerator *sharedEnumerator = nil;
- copyWithZone: (NSZone *)zone
{
GSFontInfo *copy;
copy = (GSFontInfo*) NSCopyObject (self, 0, zone);
RETAIN(fontDictionary);
RETAIN(fontName);
RETAIN(familyName);
RETAIN(weight);
RETAIN(encodingScheme);
if (NSShouldRetainWithZone(self, zone))
copy = RETAIN(self);
else
{
copy = (GSFontInfo*) NSCopyObject (self, 0, zone);
[copy->fontDictionary copyWithZone: zone];
[copy->fontName copyWithZone: zone];
[copy->familyName copyWithZone: zone];
[copy->weight copyWithZone: zone];
[copy->encodingScheme copyWithZone: zone];
}
return copy;
}