Skip to content

Commit 7ff26c2

Browse files
committed
clear handle on dispose
1 parent 4dfc0bb commit 7ff26c2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/Zlib-ng.NET/Zlibng.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public unsafe partial class Zlibng : IDisposable
1010
/// <summary>
1111
/// Library handle for the current zlib-ng instance
1212
/// </summary>
13-
public nint Handle { get; }
13+
public nint Handle { get; private set; }
1414

1515
/// <summary>
1616
/// Initializes via a native zlib-ng library path
@@ -48,8 +48,8 @@ public Zlibng(nint handle)
4848

4949
private void ReleaseUnmanagedResources()
5050
{
51-
if (Handle != nint.Zero)
52-
NativeLibrary.Free(Handle);
51+
NativeLibrary.Free(Handle);
52+
Handle = nint.Zero;
5353
}
5454

5555
/// <inheritdoc/>

0 commit comments

Comments
 (0)