uObject* uLoadWeak(uWeakObject* weak) { if (!weak) return NULL; uObject* object = uCallWithWeakRefLock(&uLoadWeak_inner, weak); uAutoRelease(object); return object; }
uObject* uLoadWeakObject(uWeakObject* weak) { if (!weak) return NULL; uObject* obj = uCallWithWeakRefLock(&uLoadWeakObject_inner, weak); uAutoReleaseObject(obj); return obj; }
void uStoreWeakObject(uWeakObject** addr, uObject* obj) { if (*addr && Xli::AtomicDecrement(&(*addr)->RefCount) == 0) U_FREE_WEAKREF(*addr); if (!obj) { *addr = NULL; return; } if (!obj->__obj_weak) uCallWithWeakRefLock(&uAllocWeakObject, obj); Xli::AtomicIncrement(&obj->__obj_weak->RefCount); *addr = obj->__obj_weak; }
void uStoreWeak(uWeakObject** address, uObject* object) { if (*address && Xli::AtomicDecrement(&(*address)->RefCount) == 0) U_FREE_WEAKREF(*address); if (!object) { *address = NULL; return; } if (!object->__weakptr) uCallWithWeakRefLock(&uNewWeak, object); Xli::AtomicIncrement(&object->__weakptr->RefCount); *address = object->__weakptr; }
static bool uTryClearWeakObject(uObject *obj) { if (!obj->__obj_weak) return true; if (!uCallWithWeakRefLock(&uTryClearWeakObject_inner, obj)) return false; if (obj->__obj_weak) { if (Xli::AtomicDecrement(&obj->__obj_weak->RefCount) == 0) U_FREE_WEAKREF(obj->__obj_weak); obj->__obj_weak = NULL; } return true; }
static bool uTryClearWeak(uObject* object) { if (!object->__weakptr) return true; if (!uCallWithWeakRefLock(&uTryClearWeak_inner, object)) return false; if (object->__weakptr) { //#if #(GC:Defined) // GC_unregister_disappearing_link((void**)&object->__weakptr->Object); //#endif if (Xli::AtomicDecrement(&object->__weakptr->RefCount) == 0) U_FREE_WEAKREF(object->__weakptr); object->__weakptr = NULL; } return true; }