Skip to content

Commit 03ea54c

Browse files
author
Vadim Belov
committed
Fix disposed state tracking in ChunkedStream
Removed readonly from _disposed to allow updating its value in Dispose(). This ensures the disposed state is properly tracked and prevents potential issues with multiple disposals.
1 parent 841d112 commit 03ea54c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Sources/EasyExtensions/Streams/ChunkedStream.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class ChunkedStream : IDisposable
1616
{
1717
private readonly Stream _baseStream;
1818
private readonly int _chunkSize;
19-
private readonly bool _disposed;
19+
private bool _disposed;
2020

2121
/// <summary>
2222
/// Initializes a new instance of the ChunkedStream class that reads from or writes to the specified base stream
@@ -75,6 +75,7 @@ public void Dispose()
7575
if (!_disposed)
7676
{
7777
_baseStream.Dispose();
78+
_disposed = true;
7879
}
7980
}
8081
}

0 commit comments

Comments
 (0)