private void Dispose(bool callFromUserCode) { if (callFromUserCode) { _isDisposed = true; } TurboJpegImport.tjDestroy(_compressorHandle); }
private void Dispose(bool callFromUserCode) { if (callFromUserCode) { _isDisposed = true; } // If for whathever reason, the handle was not initialized correctly (e.g. an exception // in the constructor), we shouldn't free it either. if (_decompressorHandle != IntPtr.Zero) { TurboJpegImport.tjDestroy(_decompressorHandle); // Set the handle to IntPtr.Zero, to prevent double execution of this method // (i.e. make calling Dispose twice a safe thing to do). _decompressorHandle = IntPtr.Zero; } }