瀏覽代碼

Initialize handle to InvalidHandle as well

svn path=/trunk/mcs/; revision=21440
Bernie Solomon 22 年之前
父節點
當前提交
6880ebfe67
共有 2 個文件被更改,包括 4 次插入1 次删除
  1. 2 1
      mcs/class/corlib/System.IO/ChangeLog
  2. 2 0
      mcs/class/corlib/System.IO/FileStream.cs

+ 2 - 1
mcs/class/corlib/System.IO/ChangeLog

@@ -2,7 +2,8 @@
 
 	* FileStream.cs: (.ctor) do not set handle
 	in object until after it is validated via
-	GetFileType so finalizer doesn't see bad handles
+	GetFileType so finalizer doesn't see bad handles and
+	initialize this.handle to InvalidHandle
 
 2003-12-19  Bernie Solomon  <[email protected]>
 

+ 2 - 0
mcs/class/corlib/System.IO/FileStream.cs

@@ -35,6 +35,8 @@ namespace System.IO
 
 		internal FileStream (IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync, bool noBuffering)
 		{
+			this.handle = MonoIO.InvalidHandle;
+
 			if (access < FileAccess.Read || access > FileAccess.ReadWrite)
 				throw new ArgumentOutOfRangeException ("access");