mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
only retain cached attributes once
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37319 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
72373b82b8
commit
0de0d89cda
1 changed files with 4 additions and 6 deletions
|
@ -151,7 +151,7 @@ cacheAttributes(NSDictionary *attrs)
|
|||
else
|
||||
{
|
||||
node->value.nsu++;
|
||||
attrs = RETAIN(node->key.obj);
|
||||
attrs = node->key.obj;
|
||||
}
|
||||
AUNLOCK();
|
||||
}
|
||||
|
@ -167,9 +167,8 @@ unCacheAttributes(NSDictionary *attrs)
|
|||
if (nil != attrs)
|
||||
{
|
||||
GSIMapBucket bucket;
|
||||
NSDictionary *found;
|
||||
NSDictionary *removed = nil;
|
||||
|
||||
found = nil;
|
||||
ALOCK();
|
||||
bucket = GSIMapBucketForKey(&attrMap, (GSIMapKey)((id)attrs));
|
||||
if (bucket != 0)
|
||||
|
@ -180,17 +179,16 @@ unCacheAttributes(NSDictionary *attrs)
|
|||
bucket, (GSIMapKey)((id)attrs));
|
||||
if (node != 0)
|
||||
{
|
||||
found = node->key.obj;
|
||||
if (--node->value.nsu == 0)
|
||||
{
|
||||
removed = node->key.obj;
|
||||
GSIMapRemoveNodeFromMap(&attrMap, bucket, node);
|
||||
GSIMapFreeNode(&attrMap, node);
|
||||
}
|
||||
}
|
||||
}
|
||||
AUNLOCK();
|
||||
NSCAssert(found == attrs, NSInternalInconsistencyException);
|
||||
RELEASE(found);
|
||||
RELEASE(removed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue