Skip to content

Commit

Permalink
Fixed objectdisposedexception
Browse files Browse the repository at this point in the history
Suppress throws from dispose
  • Loading branch information
Ezghoul committed Feb 7, 2015
1 parent 9478d50 commit bd227bb
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/BZip2/BZip2OutputStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,29 +384,33 @@ override protected void Dispose(bool disposing)
#endif
{
try {
try {
#if !NET_1_0 && !NET_1_1 && !NETCF_1_0
base.Dispose(disposing);
base.Dispose(disposing);
#endif
if( !disposed_ ) {
disposed_=true;
if( !disposed_ ) {
disposed_=true;

if( runLength>0 ) {
WriteRun();
}
if( runLength>0 ) {
WriteRun();
}

currentChar=-1;
EndBlock();
EndCompression();
Flush();
currentChar=-1;
EndBlock();
EndCompression();
Flush();
}
}
}
finally {
if ( disposing ) {
if ( IsStreamOwner ) {
baseStream.Close();
finally {
if ( disposing ) {
if ( IsStreamOwner ) {
baseStream.Close();
}
}
}
}
catch {
}
}

/// <summary>
Expand Down

0 comments on commit bd227bb

Please sign in to comment.