Author: kostat
Date: 2007-01-02 08:28:03 -0500 (Tue, 02 Jan 2007)
New Revision: 70354
Modified:
trunk/mcs/class/System/System.ComponentModel/ChangeLog
trunk/mcs/class/System/System.ComponentModel/EventHandlerList.cs
trunk/mcs/class/System/Test/System.ComponentModel/EventHandlerListTests.cs
Log:
Do not reject null key
Modified: trunk/mcs/class/System/System.ComponentModel/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.ComponentModel/ChangeLog 2007-01-02
13:07:53 UTC (rev 70353)
+++ trunk/mcs/class/System/System.ComponentModel/ChangeLog 2007-01-02
13:28:03 UTC (rev 70354)
@@ -1,3 +1,7 @@
+2007-01-02 Konstantin Triger <[EMAIL PROTECTED]>
+
+ * EventHandlerList.cs: Do not reject null key.
+
2006-12-25 Raja R Harinath <[EMAIL PROTECTED]>
* InitializationEventAttribute.cs: New.
Modified: trunk/mcs/class/System/System.ComponentModel/EventHandlerList.cs
===================================================================
--- trunk/mcs/class/System/System.ComponentModel/EventHandlerList.cs
2007-01-02 13:07:53 UTC (rev 70353)
+++ trunk/mcs/class/System/System.ComponentModel/EventHandlerList.cs
2007-01-02 13:28:03 UTC (rev 70354)
@@ -83,9 +83,6 @@
}
private ListNode FindEntry (object key)
{
- if (key == null)
- throw new ArgumentNullException ("key",
"Attempted lookup for a null key.");
-
for (ListNode entry = head; entry != null; entry =
entry.next)
if (key == entry.key)
return entry;
Modified:
trunk/mcs/class/System/Test/System.ComponentModel/EventHandlerListTests.cs
===================================================================
--- trunk/mcs/class/System/Test/System.ComponentModel/EventHandlerListTests.cs
2007-01-02 13:07:53 UTC (rev 70353)
+++ trunk/mcs/class/System/Test/System.ComponentModel/EventHandlerListTests.cs
2007-01-02 13:28:03 UTC (rev 70354)
@@ -121,6 +121,21 @@
list.Dispose ();
}
+ [Test]
+ public void NullKey ()
+ {
+ EventHandlerList list = new EventHandlerList ();
+ EventHandler one = new EventHandler (Deleg1);
+
+ list.AddHandler (null, one);
+ EventHandler d = list [null] as EventHandler;
+ Assertion.Assert ("NullKey #01", d != null);
+
+ list.RemoveHandler (null, one);
+ d = list [null] as EventHandler;
+ Assertion.Assert ("NullKey #02", d == null);
+ }
+
#if !NUNIT
void Assert (string msg, bool result)
{
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches