release method

int release()

Decrements the reference count for an interface on a COM object.

This method is automatically called by Finalizer when the object goes out of scope. Therefore, you should never call this method unless you're manually managing the lifetime of the object (i.e. by calling the detach method).

Calling this method with Finalizer attached may result in use after free and cause the process to crash.

Implementation

int release() => (ptr.ref.vtable + 2)
    .cast<Pointer<NativeFunction<Uint32 Function(Pointer)>>>()
    .value
    .asFunction<int Function(Pointer)>()(ptr.ref.lpVtbl);