diff --git a/Source/GSAttributedString.m b/Source/GSAttributedString.m index f3e78801f..d5e13f525 100644 --- a/Source/GSAttributedString.m +++ b/Source/GSAttributedString.m @@ -143,12 +143,11 @@ cacheAttributes(NSDictionary *attrs) node = GSIMapNodeForKey(&attrMap, (GSIMapKey)((id)attrs)); if (node == 0) { - /* Deep copy of dictionary, including copying objects .... - * result in an immutable dictionary that can safely be cached - * unless the copied objects or their contents are mutated. + /* Shallow copy of dictionary, without copying objects .... + * result in an immutable dictionary that can safely be cached. */ attrs = [(NSDictionary*)[GSCachedDictionary alloc] - initWithDictionary: attrs copyItems: YES]; + initWithDictionary: attrs copyItems: NO]; GSIMapAddPair(&attrMap, (GSIMapKey)((id)attrs), (GSIMapVal)(NSUInteger)1); } @@ -170,9 +169,8 @@ unCacheAttributes(NSDictionary *attrs) { if (nil != attrs) { - GSIMapBucket bucket; - BOOL found = NO; - id removed = nil; + GSIMapBucket bucket; + id removed = nil; ALOCK(); bucket = GSIMapBucketForKey(&attrMap, (GSIMapKey)((id)attrs)); @@ -184,7 +182,6 @@ unCacheAttributes(NSDictionary *attrs) bucket, (GSIMapKey)((id)attrs)); if (node != 0) { - found = YES; if (--node->value.nsu == 0) { removed = node->key.obj; @@ -198,11 +195,6 @@ unCacheAttributes(NSDictionary *attrs) { [removed _uncache]; } - if (NO == found) - { - [NSException raise: NSInternalInconsistencyException - format: @"NSAttributedString attempt to remove attributes which are not found in the cache. Did someone mutate an object in the attributes dictionary? The object to remove was %@", attrs]; - } } }