Author: toshok
Date: 2007-08-30 16:42:19 -0400 (Thu, 30 Aug 2007)
New Revision: 85078

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/collection.cpp
Log:
2007-08-30  Chris Toshok  <[EMAIL PROTECTED]>

        * collection.cpp (Collection::Add): make the warning a lot more
        useful if the child isn't of the right type.



Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-08-30 20:41:10 UTC (rev 85077)
+++ trunk/moon/src/ChangeLog    2007-08-30 20:42:19 UTC (rev 85078)
@@ -1,3 +1,8 @@
+2007-08-30  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * collection.cpp (Collection::Add): make the warning a lot more
+       useful if the child isn't of the right type.
+
 2007-08-30  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
 
        * xaml.cpp: Unref the namescope.

Modified: trunk/moon/src/collection.cpp
===================================================================
--- trunk/moon/src/collection.cpp       2007-08-30 20:41:10 UTC (rev 85077)
+++ trunk/moon/src/collection.cpp       2007-08-30 20:42:19 UTC (rev 85078)
@@ -60,7 +60,11 @@
 void
 Collection::Add (DependencyObject *data)
 {
-       g_return_if_fail 
(Type::Find(data->GetObjectType())->IsSubclassOf(GetElementType()));
+       if (!Type::Find(data->GetObjectType())->IsSubclassOf(GetElementType())) 
{
+               g_warning ("Cannot add children of type `%s' to a collection of 
type `%s'.  Its children must be subclasses of `%s'.",
+                          data->GetTypeName(), GetTypeName(), Type::Find 
(GetElementType())->name);
+               return;
+       }
        
        generation++;
        list->Append (new Collection::Node (data, this));

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

Reply via email to