pub unsafe fn release(this: *mut Self) -> u32
    {
        // Ensure we're not releasing an interface that has no references.
        //
        // Note: If the interface has no references, it has already been
        // dropped. As a result we can't guarantee that it's ref_count stays
        // as zero as the memory could have been reallocated for something else.
        //
        // However this is still an effective check in the case where the client
        // attempts to release a com pointer twice and the memory hasn't been
        // reused.
        //
        // It might not be deterministic, but in the cases where it triggers
        // it's way better than the access violation error we'd otherwise get.
        if (*this).ref_count.load(Ordering::Relaxed) == 0 {
            panic!("Attempt to release pointer with no references.");
        }

        // Decrease the ref count and store a copy of it. We'll need a local
        // copy for a return value in case we end up dropping the ComBoxData
        // instance. after the drop referencing *this would be undeterministic.
        let previous_value = (*this).ref_count.fetch_sub(1, Ordering::Relaxed);
        let rc = previous_value - 1;

        // If that was the last reference we can drop self. Do this by giving
        // it back to a box and then dropping the box. This should reverse the
        // allocation we did by boxing the value in the first place.
        if rc == 0 {
            drop(Box::from_raw(this));
        }
        rc
    }
/// Decrements the reference count. Destroys the object if the count reaches
/// zero.
///
/// Returns the reference count after the release.
///
/// # Safety
///
/// The pointer must be valid and not previously released. After the call
/// completes, the struct may have been deallocated and the pointer should
/// be considered dangling.
Decrements the reference count. Destroys the object if the count reaches
zero.

Returns the reference count after the release.
Decrements the reference count . Destroys the object if the count reaches zero . Returns the reference count after the release .
pub unsafe fn release(this: *mut Self) -> u32
    {
        // Ensure we're not releasing an interface that has no references.
        //
        // Note: If the interface has no references, it has already been
        // dropped. As a result we can't guarantee that it's ref_count stays
        // as zero as the memory could have been reallocated for something else.
        //
        // However this is still an effective check in the case where the client
        // attempts to release a com pointer twice and the memory hasn't been
        // reused.
        //
        // It might not be deterministic, but in the cases where it triggers
        // it's way better than the access violation error we'd otherwise get.
        if (*this).ref_count.load(Ordering::Relaxed) == 0 {
            panic!("Attempt to release pointer with no references.");
        }
        // Decrease the ref count and store a copy of it. We'll need a local
        // copy for a return value in case we end up dropping the ComBoxData
        // instance. after the drop referencing *this would be undeterministic.
        let previous_value = (*this).ref_count.fetch_sub(1, Ordering::Relaxed);
        let rc = previous_value - 1;
        // If that was the last reference we can drop self. Do this by giving
        // it back to a box and then dropping the box. This should reverse the
        // allocation we did by boxing the value in the first place.
        if rc == 0 {
            drop(Box::from_raw(this));
        }
        rc
    }
pub unsafe fn release ( this : * mut Self ) -> u32 { // Ensure we're not releasing an interface that has no references. // // Note: If the interface has no references, it has already been // dropped. As a result we can't guarantee that it's ref_count stays // as zero as the memory could have been reallocated for something else. // // However this is still an effective check in the case where the client // attempts to release a com pointer twice and the memory hasn't been // reused. // // It might not be deterministic, but in the cases where it triggers // it's way better than the access violation error we'd otherwise get. if ( * this ) . ref_count . load ( Ordering :: Relaxed ) == 0 { panic ! ( " " ) ; } // Decrease the ref count and store a copy of it. We'll need a local // copy for a return value in case we end up dropping the ComBoxData // instance. after the drop referencing *this would be undeterministic. let previous_value = ( * this ) . ref_count . fetch_sub ( 1 , Ordering :: Relaxed ) ; let rc = previous_value - 1 ; // If that was the last reference we can drop self. Do this by giving // it back to a box and then dropping the box. This should reverse the // allocation we did by boxing the value in the first place. if rc == 0 { drop ( Box :: from_raw ( this ) ) ; } rc }
Decrements the reference count.
Decrements the reference count .
this
*mut Self
this
*mut Self
safety
The pointer must be valid and not previously released. After the call
completes, the struct may have been deallocated and the pointer should
be considered dangling.
The pointer must be valid and not previously released . After the call completes the struct may have been deallocated and the pointer should be considered dangling .