diff --git a/ChangeLog b/ChangeLog index 1777c0cdf..c913fec60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-06-07 Richard Frith-Macdonald + + * Source/GSAttributedString.m: When caching attribute dictionaries + we make an immutable copy of the dictionary with shallow copy. + 2001-06-06 Nicola Pero Configuration part of constant string support with gcc-3.0 diff --git a/Source/GSAttributedString.m b/Source/GSAttributedString.m index 91a9026ab..721e2c85b 100644 --- a/Source/GSAttributedString.m +++ b/Source/GSAttributedString.m @@ -125,7 +125,11 @@ cacheAttributes(NSDictionary *attrs) node = GSIMapNodeForKey(&attrMap, (GSIMapKey)attrs); if (node == 0) { - attrs = [attrs copy]; + /* + * Shallow copy of dictionary, without copying objects ... results + * in an immutable dictionary that can safely be cached. + */ + attrs = [[NSDictionary alloc] initWithDictionary: attrs copyItems: NO]; GSIMapAddPair(&attrMap, (GSIMapKey)attrs, (GSIMapVal)(unsigned)1); } else