Ignore:
Timestamp:
07/16/12 11:05:57 (2 years ago)
Author:
lowjoel
Message:

When an exception is thrown in the VolumeLock? constructor, do not execute the cleanup code since it cannot run. At the same time, make the Dispose method idempotent, as required by IDisposable.

Fixes https://eraser.heidi.ie/forum/viewtopic.php?f=2&t=8866

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/6.0/Eraser.Util/VolumeInfo.cs

    r2664 r2780  
    734734                GC.SuppressFinalize(this); 
    735735 
     736            //If we have already run, or if we did not lock the volume in the first place 
     737            //do not do stream cleanup. 
     738            if (Stream == null) 
     739                return; 
     740 
    736741            //Flush the contents of the buffer to disk since after we unlock the volume 
    737742            //we can no longer write to the volume. 
     
    746751                    new Win32Exception(Marshal.GetLastWin32Error())); 
    747752            } 
     753 
     754            //Make this idempotent. 
     755            Stream = null; 
    748756        } 
    749757 
Note: See TracChangeset for help on using the changeset viewer.