virtual ULONG STDMETHODCALLTYPE Release(void) { uintptr_t new_ref = vlc_atomic_dec(&m_ref_); if (new_ref == 0) delete this; return new_ref; }
/** * Atomically decrement the reference count and, if it reaches zero, destroy. * @param p_gc reference counted object. */ void vlc_release (gc_object_t *p_gc) { uintptr_t refs; assert( p_gc ); refs = vlc_atomic_dec (&p_gc->refs); assert (refs != (uintptr_t)(-1)); /* reference underflow?! */ if (refs == 0) p_gc->pf_destructor (p_gc); }
void picture_Release( picture_t *p_picture ) { uintptr_t refs = vlc_atomic_dec( &p_picture->gc.refcount ); assert( refs != (uintptr_t)-1 ); if( refs > 0 ) return; if( p_picture->gc.pf_destroy != NULL ) p_picture->gc.pf_destroy( p_picture ); }
void picture_Release( picture_t *p_picture ) { if( vlc_atomic_dec( &p_picture->gc.refcount ) == 0 && p_picture->gc.pf_destroy ) p_picture->gc.pf_destroy( p_picture ); }