/// <summary> /// Frees any resources associated with this object. /// </summary> /// <param name="disposing"> /// True if managed objects as well as unmanaged should be disposed. /// </param> protected virtual void Dispose(bool disposing) { if (disposing) { // Free other state (managed objects). } // Free unmanaged objects. IntPtr handlePtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr))); Marshal.WriteIntPtr(handlePtr, this.Handle); hbFunctions.hb_close(handlePtr); Marshal.FreeHGlobal(handlePtr); this.disposed = true; }