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:
copilot-swe-agent[bot]
2026-01-22 15:50:05 +00:00
parent b4f949ba9b
commit 336a8f2876
2 changed files with 13 additions and 2 deletions

View File

@@ -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)
{

View File

@@ -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();