Bah! Something went wrong on that patch, looks like an EOL-style thing.

Better patch attached.

Let me know if it's good to commit.

Alan.



On 3/27/07, Alan McGovern <[EMAIL PROTECTED]> wrote:

I was looking at the Queue code and i noticed that version wasn't
incremented when Queue.Clear() was called.

Here's a patch and NUnit test to show the problem.

Alan


Index: C:/programming/mcs/class/System/System.Collections.Generic/Queue.cs
===================================================================
--- C:/programming/mcs/class/System/System.Collections.Generic/Queue.cs	(revision 74942)
+++ C:/programming/mcs/class/System/System.Collections.Generic/Queue.cs	(working copy)
@@ -80,6 +80,7 @@
 				Array.Clear (data, 0, data.Length);
 			
 			head = tail = size = 0;
+			version++;
 		}
 		
 		public bool Contains (T item)
Index: C:/programming/mcs/class/System/Test/System.Collections.Generic/QueueTest.cs
===================================================================
--- C:/programming/mcs/class/System/Test/System.Collections.Generic/QueueTest.cs	(revision 75004)
+++ C:/programming/mcs/class/System/Test/System.Collections.Generic/QueueTest.cs	(working copy)
@@ -71,6 +71,17 @@
 			s.Clear ();
 			
 			AssertEquals (s.Count, 0);
+
+			IEnumerator enumerator = queue.GetEnumerator();
+			queue.Clear();
+			try
+			{
+				enumerator.Reset();
+				Assert.Fail("Version should've been incremented");
+			}
+			catch(InvalidOperationException)
+			{
+			}
 		}
 		
 		[Test]
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to