[Pkg-mono-svn-commits] [SCM] mono branch, master, updated. debian/2.4.4.svn151842-2-51-g38682b8

Mirco Bauer meebey at meebey.net
Thu Jun 24 23:39:43 UTC 2010


The following commit has been merged in the master branch:
commit 54a27867936b7b8c3238e2bb9c2efaa3c1432474
Author: Jo Shields <directhex at apebox.org>
Date:   Tue Jun 22 09:16:34 2010 +0100

    GetTypeDescriptor must return the value from a call forwarded to _parent. Fixes Novell bug #603060
    (taken from upstream SVN rev 157626)

diff --git a/mcs/class/System/System.ComponentModel/TypeDescriptionProvider.cs b/mcs/class/System/System.ComponentModel/TypeDescriptionProvider.cs
index a7d29aa..63e18d0 100644
--- a/mcs/class/System/System.ComponentModel/TypeDescriptionProvider.cs
+++ b/mcs/class/System/System.ComponentModel/TypeDescriptionProvider.cs
@@ -135,7 +135,7 @@ namespace System.ComponentModel
 		public virtual ICustomTypeDescriptor GetTypeDescriptor (Type objectType, object instance)
 		{
 			if (_parent != null)
-				_parent.GetTypeDescriptor (objectType, instance);
+				return _parent.GetTypeDescriptor (objectType, instance);
 
 			if (_emptyCustomTypeDescriptor == null)
 				_emptyCustomTypeDescriptor = new EmptyCustomTypeDescriptor ();
diff --git a/mcs/class/System/System.ComponentModel/TypeDescriptor.cs b/mcs/class/System/System.ComponentModel/TypeDescriptor.cs
index ab40a25..35df4f0 100644
--- a/mcs/class/System/System.ComponentModel/TypeDescriptor.cs
+++ b/mcs/class/System/System.ComponentModel/TypeDescriptor.cs
@@ -126,6 +126,7 @@ public sealed class TypeDescriptor
 
 			plist.AddLast (provider);
 			instanceWrapper = null;
+			Refresh (instance);
 		}
 	}
 
@@ -146,6 +147,7 @@ public sealed class TypeDescriptor
 			}
 
 			plist.AddLast (provider);
+			Refresh (type);
 		}
 	}
 
@@ -772,6 +774,9 @@ public sealed class TypeDescriptor
 		}
 
 		if (ret == null)
+			ret = GetProvider (instance.GetType ());
+
+		if (ret == null)
 			return new DefaultTypeDescriptionProvider ();
 		else
 			return new WrappedTypeDescriptionProvider (ret);
@@ -787,7 +792,14 @@ public sealed class TypeDescriptor
 		lock (typeDescriptionProvidersLock) {
 			LinkedList <TypeDescriptionProvider> plist;
 			
-			if (typeDescriptionProviders.TryGetValue (type, out plist) && plist.Count > 0)
+			while (!typeDescriptionProviders.TryGetValue (type, out plist)) {
+				plist = null;
+				type = type.BaseType;
+				if (type == null)
+					break;
+			}
+
+			if (plist != null && plist.Count > 0)
 				ret = plist.Last.Value;
 		}
 
@@ -851,14 +863,14 @@ public sealed class TypeDescriptor
 		if (instance == null)
 			throw new ArgumentNullException ("instance");
 
-		bool removed = false;
+		//bool removed = false;
 		lock (componentDescriptionProvidersLock) {
 			LinkedList <TypeDescriptionProvider> plist;
 			WeakObjectWrapper instanceWrapper = new WeakObjectWrapper (instance);
 
 			if (componentDescriptionProviders.TryGetValue (instanceWrapper, out plist) && plist.Count > 0) {
 				RemoveProvider (provider, plist);
-				removed = true;
+				//removed = true;
 			}
 			
 			instanceWrapper = null;
@@ -877,13 +889,11 @@ public sealed class TypeDescriptor
 		if (type == null)
 			throw new ArgumentNullException ("type");
 
-		bool removed = false;
 		lock (typeDescriptionProvidersLock) {
 			LinkedList <TypeDescriptionProvider> plist;
 
 			if (typeDescriptionProviders.TryGetValue (type, out plist) && plist.Count > 0) {
 				RemoveProvider (provider, plist);
-				removed = true;
 			}
 		}
 
@@ -1116,7 +1126,12 @@ public sealed class TypeDescriptor
 
 		public override ICustomTypeDescriptor GetTypeDescriptor (Type objectType, object instance)
 		{
-			return new DefaultTypeDescriptor (this, objectType, instance);
+			TypeDescriptionProvider wrapped = Wrapped;
+
+			if (wrapped == null)
+				return new DefaultTypeDescriptor (this, objectType, instance);
+
+			return wrapped.GetTypeDescriptor (objectType, instance);
 		}
 	}
 

-- 
mono



More information about the Pkg-mono-svn-commits mailing list