From af3d05ffc74fbc907056fadff7957e61b4fb10bc Mon Sep 17 00:00:00 2001 From: rfm Date: Wed, 30 Oct 2013 22:28:44 +0000 Subject: [PATCH] revert last change git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37337 72102866-910b-0410-8b05-ffd578937521 --- Source/GSAttributedString.m | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) 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]; - } } }