Author: alanmc
Date: 2007-03-27 09:39:33 -0500 (Tue, 27 Mar 2007)
New Revision: 75020

Modified:
   trunk/mcs/class/System/System.Collections.Generic/ChangeLog
   trunk/mcs/class/System/System.Collections.Generic/Queue.cs
   trunk/mcs/class/System/System.Collections.Generic/Stack.cs
   trunk/mcs/class/System/Test/System.Collections.Generic/QueueTest.cs
   trunk/mcs/class/System/Test/System.Collections.Generic/StackTest.cs
Log:
Bugfix for incrementing the version incorrectly in queue and stack

Modified: trunk/mcs/class/System/System.Collections.Generic/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Collections.Generic/ChangeLog 2007-03-27 
14:35:36 UTC (rev 75019)
+++ trunk/mcs/class/System/System.Collections.Generic/ChangeLog 2007-03-27 
14:39:33 UTC (rev 75020)
@@ -1,3 +1,8 @@
+2007-03-27  Alan McGovern <[EMAIL PROTECTED]>
+
+       * Queue.cs: Removed wrong call to version++
+       * Stack.cs: Removed wrong call to version++
+
 2006-09-30  Gert Driesen  <[EMAIL PROTECTED]>
 
        * SortedList.cs: Count property, indexer and Clear method should not 

Modified: trunk/mcs/class/System/System.Collections.Generic/Queue.cs
===================================================================
--- trunk/mcs/class/System/System.Collections.Generic/Queue.cs  2007-03-27 
14:35:36 UTC (rev 75019)
+++ trunk/mcs/class/System/System.Collections.Generic/Queue.cs  2007-03-27 
14:39:33 UTC (rev 75020)
@@ -80,6 +80,7 @@
                                Array.Clear (data, 0, data.Length);
                        
                        head = tail = size = 0;
+                       version++;
                }
                
                public bool Contains (T item)

Modified: trunk/mcs/class/System/System.Collections.Generic/Stack.cs
===================================================================
--- trunk/mcs/class/System/System.Collections.Generic/Stack.cs  2007-03-27 
14:35:36 UTC (rev 75019)
+++ trunk/mcs/class/System/System.Collections.Generic/Stack.cs  2007-03-27 
14:39:33 UTC (rev 75020)
@@ -108,8 +108,6 @@
                        if (size == 0)
                                throw new InvalidOperationException ();
                        
-                       ver ++;
-                       
                        return data [size - 1];
                }
                

Modified: trunk/mcs/class/System/Test/System.Collections.Generic/QueueTest.cs
===================================================================
--- trunk/mcs/class/System/Test/System.Collections.Generic/QueueTest.cs 
2007-03-27 14:35:36 UTC (rev 75019)
+++ trunk/mcs/class/System/Test/System.Collections.Generic/QueueTest.cs 
2007-03-27 14:39:33 UTC (rev 75020)
@@ -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]

Modified: trunk/mcs/class/System/Test/System.Collections.Generic/StackTest.cs
===================================================================
--- trunk/mcs/class/System/Test/System.Collections.Generic/StackTest.cs 
2007-03-27 14:35:36 UTC (rev 75019)
+++ trunk/mcs/class/System/Test/System.Collections.Generic/StackTest.cs 
2007-03-27 14:39:33 UTC (rev 75020)
@@ -110,6 +110,10 @@
                        
                        AssertEquals (s.Peek (), 1);
                        AssertEquals (s.Count, 1);
+
+                   enumerator = s.GetEnumerator();
+                       s.Peek();
+                       enumerator.Reset();
                }
                
                [Test]

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to