Skip to content

Commit

Permalink
Fixes Double Dispose() of ZipWritingStream #294 #294 (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
aienabled authored and adamhathcock committed Sep 8, 2017
1 parent 0f511c4 commit 08fee76
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/SharpCompress/Writers/Zip/ZipWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ internal class ZipWritingStream : Stream

// Flag to prevent throwing exceptions on Dispose
private bool limitsExceeded;
private bool isDisposed;

internal ZipWritingStream(ZipWriter writer, Stream originalStream, ZipCentralDirectoryEntry entry,
ZipCompressionMethod zipCompressionMethod, CompressionLevel compressionLevel)
Expand Down Expand Up @@ -344,6 +345,13 @@ private Stream GetWriteStream(Stream writeStream)

protected override void Dispose(bool disposing)
{
if (isDisposed)
{
return;
}

isDisposed = true;

base.Dispose(disposing);
if (disposing)
{
Expand Down

0 comments on commit 08fee76

Please sign in to comment.