Sfoglia il codice sorgente

2007-07-28 Miguel de Icaza <[email protected]>

	* IdentityReference.cs, SecurityIdentifier.cs, NTAccount.cs: Do
	not recurse infinitely as reported by Jesse Jones, the problem was
	the comparison to null.


svn path=/trunk/mcs/; revision=82912
Miguel de Icaza 18 anni fa
parent
commit
4728609ef2

+ 6 - 0
mcs/class/corlib/System.Security.Principal/ChangeLog

@@ -1,3 +1,9 @@
+2007-07-28  Miguel de Icaza  <[email protected]>
+
+	* IdentityReference.cs, SecurityIdentifier.cs, NTAccount.cs: Do
+	not recurse infinitely as reported by Jesse Jones, the problem was
+	the comparison to null.
+
 2006-12-22  Sebastien Pouliot  <[email protected]>
 
 	* NTAccount.cs: Implement == and != operators (MoMA reports).

+ 6 - 6
mcs/class/corlib/System.Security.Principal/IdentityReference.cs

@@ -61,18 +61,18 @@ namespace System.Security.Principal {
 
 		public static bool operator== (IdentityReference left, IdentityReference right)
 		{
-			if (left == null)
-				return (right == null);
-			if (right == null)
+			if (((object)left) == null)
+				return (((object)right) == null);
+			if (((object)right) == null)
 				return false;
 			return (left.Value == right.Value);
 		}
 
 		public static bool operator!= (IdentityReference left, IdentityReference right)
 		{
-			if (left == null)
-				return (right != null);
-			if (right == null)
+			if (((object)left) == null)
+				return (((object)right) != null);
+			if (((object)right) == null)
 				return true;
 			return (left.Value != right.Value);
 		}

+ 6 - 6
mcs/class/corlib/System.Security.Principal/NTAccount.cs

@@ -101,18 +101,18 @@ namespace System.Security.Principal {
 
 		public static bool operator == (NTAccount left, NTAccount right)
 		{
-			if (left == null)
-				return (right == null);
-			if (right == null)
+			if (((object)left) == null)
+				return (((object)right) == null);
+			if (((object)right) == null)
 				return false;
 			return (left.Value == right.Value);
 		}
 
 		public static bool operator != (NTAccount left, NTAccount right)
 		{
-			if (left == null)
-				return (right != null);
-			if (right == null)
+			if (((object)left) == null)
+				return (((object)right) != null);
+			if (((object)right) == null)
 				return true;
 			return (left.Value != right.Value);
 		}

+ 6 - 6
mcs/class/corlib/System.Security.Principal/SecurityIdentifier.cs

@@ -176,18 +176,18 @@ namespace System.Security.Principal {
 
 		public static bool operator == (SecurityIdentifier left, SecurityIdentifier right)
 		{
-			if (left == null)
-				return (right == null);
-			if (right == null)
+			if (((object)left) == null)
+				return (((object)right) == null);
+			if (((object)right) == null)
 				return false;
 			return (left.Value == right.Value);
 		}
 
 		public static bool operator != (SecurityIdentifier left, SecurityIdentifier right)
 		{
-			if (left == null)
-				return (right != null);
-			if (right == null)
+			if (((object)left) == null)
+				return (((object)right) != null);
+			if (((object)right) == null)
 				return true;
 			return (left.Value != right.Value);
 		}

+ 28 - 0
mcs/class/corlib/System.Threading/ChangeLog

@@ -1,3 +1,31 @@
+2007-07-21  Miguel de Icaza  <[email protected]>
+
+	* WaitHandle.cs (Handle): It turns out that we should never create
+	new SafeWaitHandles, as applications will assume that a
+	SafeWaitHandle pulled from this will be the same after a Handle
+	update (from Gert's test):
+
+	
+                AutoResetEvent are1 = new AutoResetEvent (false);
+                AutoResetEvent are2 = new AutoResetEvent (false);
+                SafeWaitHandle swh1 = are1.SafeWaitHandle;
+                Console.WriteLine ("#A1:" + !swh1.IsClosed);
+                Console.WriteLine ("#A2:" + !swh1.IsInvalid);
+                IntPtr dummyHandle = (IntPtr) 2;
+                are1.Handle = dummyHandle;
+                Console.WriteLine ("#A3:" + (are1.Handle == dummyHandle));
+                Console.WriteLine ("#A4:" + !swh1.IsClosed);
+                Console.WriteLine ("#A5:" + !swh1.IsClosed);
+                Console.WriteLine ("#A6:" + !swh1.IsInvalid);
+                Console.WriteLine ("#A7:" + !are1.SafeWaitHandle.IsClosed);
+                Console.WriteLine ("#A8:" +
+	        !are1.SafeWaitHandle.IsInvalid);
+
+	We would return in A4, A5, A6 true, even when we have set the
+	Handle ourselves. 
+
+	* 
+
 2007-07-18  Miguel de Icaza  <[email protected]>
 
 	* WaitHandle.cs (Handle): in the 2.0 profile, explicitly dispose