revert last change

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37337 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2013-10-30 22:28:44 +00:00
parent 4b3d5ae5b2
commit af3d05ffc7

View file

@ -143,12 +143,11 @@ cacheAttributes(NSDictionary *attrs)
node = GSIMapNodeForKey(&attrMap, (GSIMapKey)((id)attrs)); node = GSIMapNodeForKey(&attrMap, (GSIMapKey)((id)attrs));
if (node == 0) if (node == 0)
{ {
/* Deep copy of dictionary, including copying objects .... /* Shallow copy of dictionary, without copying objects ....
* result in an immutable dictionary that can safely be cached * result in an immutable dictionary that can safely be cached.
* unless the copied objects or their contents are mutated.
*/ */
attrs = [(NSDictionary*)[GSCachedDictionary alloc] attrs = [(NSDictionary*)[GSCachedDictionary alloc]
initWithDictionary: attrs copyItems: YES]; initWithDictionary: attrs copyItems: NO];
GSIMapAddPair(&attrMap, GSIMapAddPair(&attrMap,
(GSIMapKey)((id)attrs), (GSIMapVal)(NSUInteger)1); (GSIMapKey)((id)attrs), (GSIMapVal)(NSUInteger)1);
} }
@ -170,9 +169,8 @@ unCacheAttributes(NSDictionary *attrs)
{ {
if (nil != attrs) if (nil != attrs)
{ {
GSIMapBucket bucket; GSIMapBucket bucket;
BOOL found = NO; id<GSCachedDictionary> removed = nil;
id<GSCachedDictionary> removed = nil;
ALOCK(); ALOCK();
bucket = GSIMapBucketForKey(&attrMap, (GSIMapKey)((id)attrs)); bucket = GSIMapBucketForKey(&attrMap, (GSIMapKey)((id)attrs));
@ -184,7 +182,6 @@ unCacheAttributes(NSDictionary *attrs)
bucket, (GSIMapKey)((id)attrs)); bucket, (GSIMapKey)((id)attrs));
if (node != 0) if (node != 0)
{ {
found = YES;
if (--node->value.nsu == 0) if (--node->value.nsu == 0)
{ {
removed = node->key.obj; removed = node->key.obj;
@ -198,11 +195,6 @@ unCacheAttributes(NSDictionary *attrs)
{ {
[removed _uncache]; [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];
}
} }
} }