Przeglądaj źródła

2007-08-14 Marek Habersack <[email protected]>

	* AspComponentFoundry.cs: use an ArrayList to implement LIFO for
	component collections, instead of the old Queue which implemented
	FIFO. Fixes situations when a control registered later for a
	certain prefix would not be used in preference to a previously
	registered one of the same name.

svn path=/trunk/mcs/; revision=84040
Marek Habersack 18 lat temu
rodzic
commit
32c8a3a371

+ 10 - 10
mcs/class/System.Web/System.Web.Compilation/AspComponentFoundry.cs

@@ -72,13 +72,13 @@ namespace System.Web.Compilation
 			if (o is Foundry)
 				return ((Foundry)o).GetType (tag);
 
-			Queue qf = o as Queue;
-			if (qf == null)
+			ArrayList af = o as ArrayList;
+			if (af == null)
 				return null;
 
 			Type t;
 			Exception e = null;
-			foreach (Foundry f in qf) {
+			foreach (Foundry f in af) {
 				try {
 					t = f.GetType (tag);
 					if (t != null)
@@ -168,7 +168,7 @@ namespace System.Web.Compilation
 			if (f is CompoundFoundry) {
 				((CompoundFoundry) f).Add (foundry);
 				return;
-			} else if (f == null || f is Queue || (f is AssemblyFoundry && foundry is AssemblyFoundry)) {
+			} else if (f == null || f is ArrayList || (f is AssemblyFoundry && foundry is AssemblyFoundry)) {
 				newFoundry = foundry;
 			} else if (f != null) {
 				CompoundFoundry compound = new CompoundFoundry (foundryName);
@@ -185,14 +185,14 @@ namespace System.Web.Compilation
 				return;
 			}
 
-			Queue lf = f as Queue;
-			if (lf == null) {
-				lf = new Queue (2);
-				lf.Enqueue (f);
-				foundries [foundryName] = lf;
+			ArrayList af = f as ArrayList;
+			if (af == null) {
+				af = new ArrayList (2);
+				af.Add (f);
+				foundries [foundryName] = af;
 			}
 			
-			lf.Enqueue (newFoundry);
+			af.Insert (0, newFoundry);
 		}
 
 		public bool LookupFoundry (string foundryName)

+ 8 - 0
mcs/class/System.Web/System.Web.Compilation/ChangeLog

@@ -1,3 +1,11 @@
+2007-08-14  Marek Habersack  <[email protected]>
+
+	* AspComponentFoundry.cs: use an ArrayList to implement LIFO for
+	component collections, instead of the old Queue which implemented
+	FIFO. Fixes situations when a control registered later for a
+	certain prefix would not be used in preference to a previously
+	registered one of the same name.
+
 2007-08-06  Marek Habersack  <[email protected]>
 
 	* AspComponentFoundry.cs: properly add new foundry if the