public V2DepthFrame(IDepthFrameReader reader, IntPtr handle) { try { _data = reader.GetFrameArrivedEventData(handle); _reference = _data.get_FrameReference(); SetFrame(_reference.AcquireFrame()); } catch (COMException) { Dispose(); } }
protected override void OnDispose() { if (_description != null) { Marshal.ReleaseComObject(_description); _description = null; } if (_frame != null) { Marshal.ReleaseComObject(_frame); _frame = null; } if (_reference != null) { Marshal.ReleaseComObject(_reference); _reference = null; } if (_data != null) { Marshal.ReleaseComObject(_data); _data = null; } }