public void Cleanup(IntPtr nativeHandle, Action callback) { // Remove handle if (NativeHandle != IntPtr.Zero) { Loop.handles.Remove(nativeHandle); UV.Free(nativeHandle); NativeHandle = IntPtr.Zero; if (Closed != null) { Closed(); } if (callback != null) { callback(); } if (GCHandle.IsAllocated) { GCHandle.Free(); } } }
protected virtual void Dispose(bool disposing) { if (disposing) { GC.SuppressFinalize(this); } UV.Free(NativeHandle); GCHandle.Free(); NativeHandle = IntPtr.Zero; }
public virtual void Dispose(bool disposing) { if (Data != IntPtr.Zero) { if (GCHandle.IsAllocated) { GCHandle.Free(); } Data = IntPtr.Zero; } if (Handle != IntPtr.Zero) { UV.Free(Handle); Handle = IntPtr.Zero; } }
protected void Dispose(bool disposing) { if (disposing) { GC.SuppressFinalize(this); } if (Handle != IntPtr.Zero) { if (destroy != null) { destroy(Handle); } UV.Free(Handle); Handle = IntPtr.Zero; } }
public virtual void Dispose(bool disposing) { if (disposing) { GC.SuppressFinalize(this); } if (Data != IntPtr.Zero) { if (GCHandle.IsAllocated) { GCHandle.Free(); } UV.Free(Data); Data = IntPtr.Zero; } if (Handle != IntPtr.Zero) { UV.Free(Handle); Handle = IntPtr.Zero; } }