mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +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
5ecbbfe3bb
commit
4ebaa799a5
1 changed files with 4 additions and 6 deletions
|
@ -151,7 +151,7 @@ cacheAttributes(NSDictionary *attrs)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
node->value.nsu++;
|
node->value.nsu++;
|
||||||
attrs = RETAIN(node->key.obj);
|
attrs = node->key.obj;
|
||||||
}
|
}
|
||||||
AUNLOCK();
|
AUNLOCK();
|
||||||
}
|
}
|
||||||
|
@ -167,9 +167,8 @@ unCacheAttributes(NSDictionary *attrs)
|
||||||
if (nil != attrs)
|
if (nil != attrs)
|
||||||
{
|
{
|
||||||
GSIMapBucket bucket;
|
GSIMapBucket bucket;
|
||||||
NSDictionary *found;
|
NSDictionary *removed = nil;
|
||||||
|
|
||||||
found = nil;
|
|
||||||
ALOCK();
|
ALOCK();
|
||||||
bucket = GSIMapBucketForKey(&attrMap, (GSIMapKey)((id)attrs));
|
bucket = GSIMapBucketForKey(&attrMap, (GSIMapKey)((id)attrs));
|
||||||
if (bucket != 0)
|
if (bucket != 0)
|
||||||
|
@ -180,17 +179,16 @@ unCacheAttributes(NSDictionary *attrs)
|
||||||
bucket, (GSIMapKey)((id)attrs));
|
bucket, (GSIMapKey)((id)attrs));
|
||||||
if (node != 0)
|
if (node != 0)
|
||||||
{
|
{
|
||||||
found = node->key.obj;
|
|
||||||
if (--node->value.nsu == 0)
|
if (--node->value.nsu == 0)
|
||||||
{
|
{
|
||||||
|
removed = node->key.obj;
|
||||||
GSIMapRemoveNodeFromMap(&attrMap, bucket, node);
|
GSIMapRemoveNodeFromMap(&attrMap, bucket, node);
|
||||||
GSIMapFreeNode(&attrMap, node);
|
GSIMapFreeNode(&attrMap, node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AUNLOCK();
|
AUNLOCK();
|
||||||
NSCAssert(found == attrs, NSInternalInconsistencyException);
|
RELEASE(removed);
|
||||||
RELEASE(found);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue