mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-04 05:25:00 +00:00
Fix SharpCompressStream Dispose methods to set _isDisposed and call base.Dispose even when LeaveOpen is true
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
This commit is contained in:
@@ -154,7 +154,7 @@ public partial class SharpCompressStream
|
||||
#if DEBUG_STREAMS
|
||||
this.DebugDispose(typeof(SharpCompressStream));
|
||||
#endif
|
||||
if (_isDisposed || LeaveOpen)
|
||||
if (_isDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -167,6 +167,11 @@ public partial class SharpCompressStream
|
||||
_isDisposed = true;
|
||||
await base.DisposeAsync();
|
||||
|
||||
if (LeaveOpen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await Stream.DisposeAsync();
|
||||
if (_buffer != null)
|
||||
{
|
||||
|
||||
@@ -141,7 +141,7 @@ public partial class SharpCompressStream : Stream, IStreamStack
|
||||
#if DEBUG_STREAMS
|
||||
this.DebugDispose(typeof(SharpCompressStream));
|
||||
#endif
|
||||
if (_isDisposed || this.LeaveOpen)
|
||||
if (_isDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -154,6 +154,12 @@ public partial class SharpCompressStream : Stream, IStreamStack
|
||||
}
|
||||
_isDisposed = true;
|
||||
base.Dispose(disposing);
|
||||
|
||||
if (this.LeaveOpen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
Stream.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user