X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/5c19dc3ae3bd8e40a9c028b0deddd50ff337692c..3a7be6fd655a5b07ffb821947ed6ba5fdc4bea8c:/OSX/libsecurity_utilities/lib/seccfobject.cpp diff --git a/OSX/libsecurity_utilities/lib/seccfobject.cpp b/OSX/libsecurity_utilities/lib/seccfobject.cpp index 142a2730..11220f45 100644 --- a/OSX/libsecurity_utilities/lib/seccfobject.cpp +++ b/OSX/libsecurity_utilities/lib/seccfobject.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include SecPointerBase::SecPointerBase(const SecPointerBase& p) { @@ -40,20 +40,6 @@ SecPointerBase::SecPointerBase(const SecPointerBase& p) } - - -static void CheckForRelease(SecCFObject* ptr) -{ - CFTypeRef tr = ptr->operator CFTypeRef(); - CFIndex retainCount = CFGetRetainCount(tr); - if (retainCount == 1 || retainCount == -1) - { - ptr->aboutToDestruct(); - } -} - - - SecPointerBase::SecPointerBase(SecCFObject *p) { if (p && !p->isNew()) @@ -69,7 +55,6 @@ SecPointerBase::~SecPointerBase() { if (ptr) { - CheckForRelease(ptr); CFRelease(ptr->operator CFTypeRef()); } } @@ -85,7 +70,6 @@ SecPointerBase& SecPointerBase::operator = (const SecPointerBase& p) } if (ptr) { - CheckForRelease(ptr); CFRelease(ptr->operator CFTypeRef()); } ptr = p.ptr; @@ -102,7 +86,6 @@ void SecPointerBase::assign(SecCFObject * p) } if (ptr) { - CheckForRelease(ptr); CFRelease(ptr->operator CFTypeRef()); } ptr = p; @@ -114,7 +97,6 @@ void SecPointerBase::copy(SecCFObject * p) { if (ptr) { - CheckForRelease(ptr); CFRelease(ptr->operator CFTypeRef()); } @@ -153,14 +135,10 @@ SecCFObject::allocate(size_t size, const CFClass &cfclass) throw(std::bad_alloc) if (p == NULL) throw std::bad_alloc(); - ((SecRuntimeBase*) p)->isNew = true; + atomic_flag_clear(&((SecRuntimeBase*) p)->isOld); void *q = ((u_int8_t*) p) + kAlignedRuntimeSize; - if (SECURITY_DEBUG_SEC_CREATE_ENABLED()) { - const CFRuntimeClass *rtc = _CFRuntimeGetClassWithTypeID(cfclass.typeID); - SECURITY_DEBUG_SEC_CREATE(q, rtc ? (char *)rtc->className : NULL, (unsigned int)cfclass.typeID); - } return q; } @@ -212,7 +190,7 @@ uint32_t SecCFObject::updateRetainCount(intptr_t direction, uint32_t *oldCount) SecCFObject::~SecCFObject() { - SECURITY_DEBUG_SEC_DESTROY(this); + //SECURITY_DEBUG_SEC_DESTROY(this); } bool @@ -257,7 +235,7 @@ SecCFObject::aboutToDestruct() Mutex* -SecCFObject::getMutexForObject() +SecCFObject::getMutexForObject() const { return NULL; // we only worry about descendants of KeychainImpl and ItemImpl }