/// <summary> /// Initializes a new instance of the <see cref="BodyTracker"/> class. /// </summary> /// <param name="handle"></param> internal BodyTracker(NativeMethods.k4abt_tracker_t handle) { // Hook the native allocator and register this object. // .Dispose() will be called on this object when the allocator is shut down. Allocator.Singleton.RegisterForDisposal(this); this.handle = handle; }
protected virtual void Dispose(bool disposing) { if (!this.disposedValue && disposing) { Allocator.Singleton.UnregisterForDisposal(this); this.handle.Close(); this.handle = null; this.disposedValue = true; } }