X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/5c19dc3ae3bd8e40a9c028b0deddd50ff337692c..dd5fb164cf5b32c462296bc65e289e100f74b59a:/OSX/libsecurity_utilities/lib/cfclass.cpp?ds=inline diff --git a/OSX/libsecurity_utilities/lib/cfclass.cpp b/OSX/libsecurity_utilities/lib/cfclass.cpp index 75244e0c..530edb4b 100644 --- a/OSX/libsecurity_utilities/lib/cfclass.cpp +++ b/OSX/libsecurity_utilities/lib/cfclass.cpp @@ -26,8 +26,6 @@ #include #include #include -#include -#include // // CFClass @@ -60,42 +58,11 @@ CFClass::cleanupObject(intptr_t op, CFTypeRef cf, bool &zap) // the default is to not throw away the object zap = false; - bool isGC = CF_IS_COLLECTABLE(cf); - uint32_t currentCount; SecCFObject *obj = SecCFObject::optional(cf); uint32_t oldCount; currentCount = obj->updateRetainCount(op, &oldCount); - - if (isGC) - { - auto_zone_t* zone = objc_collectableZone(); - - if (op == -1 && oldCount == 0) - { - auto_zone_release(zone, (void*) cf); - } - else if (op == 1 && oldCount == 0 && currentCount == 1) - { - auto_zone_retain(zone, (void*) cf); - } - else if (op == -1 && oldCount == 1 && currentCount == 0) - { - /* - To prevent accidental resurrection, just pull it out of the - cache. - */ - obj->aboutToDestruct(); - auto_zone_release(zone, (void*) cf); - } - else if (op == 0) - { - return currentCount; - } - - return 0; - } if (op == 0) { @@ -163,23 +130,14 @@ void CFClass::finalizeType(CFTypeRef cf) throw() { /* - Why are we asserting the mutex here as well as in refCountForType? - Because the way we control the objects and the queues are different - under GC than they are under non-GC operations. - - In non-GC, we need to control the lifetime of the object. This means + We need to control the lifetime of the object. This means that the cache lock has to be asserted while we are determining if the object should live or die. The mutex is recursive, which means that we won't end up with mutex inversion. - - In GC, GC figures out the lifetime of the object. We probably don't need - to assert the mutex here, but it doesn't hurt. */ SecCFObject *obj = SecCFObject::optional(cf); - bool isCollectable = CF_IS_COLLECTABLE(cf); - try { Mutex* mutex = obj->getMutexForObject(); @@ -207,11 +165,6 @@ CFClass::finalizeType(CFTypeRef cf) throw() catch(...) { } - - if (isCollectable) - { - delete obj; - } } Boolean