Author: miguel
Date: 2007-01-01 21:02:29 -0500 (Mon, 01 Jan 2007)
New Revision: 70330

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/icall.c
   trunk/mono/mono/metadata/loader.c
Log:
2007-01-01  Miguel de Icaza  <[EMAIL PROTECTED]>

        * icall.c (ves_icall_System_Reflection_Assembly_InternalGetType):
        Clear the error before returning to unmanaged code to prevent the
        runtime from being confused later on (fixes  80420).
        (ves_icall_type_from_name): Always call mono_loader_clear_error
        after parsing a type that could have failed.
        (ves_icall_System_Reflection_Assembly_GetTypes): ditto.

        * loader.c (mono_loader_clear_error): Fix indentation.




Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2007-01-01 22:39:12 UTC (rev 70329)
+++ trunk/mono/mono/metadata/ChangeLog  2007-01-02 02:02:29 UTC (rev 70330)
@@ -1,3 +1,14 @@
+2007-01-01  Miguel de Icaza  <[EMAIL PROTECTED]>
+
+       * icall.c (ves_icall_System_Reflection_Assembly_InternalGetType):
+       Clear the error before returning to unmanaged code to prevent the
+       runtime from being confused later on (fixes  80420).
+       (ves_icall_type_from_name): Always call mono_loader_clear_error
+       after parsing a type that could have failed.
+       (ves_icall_System_Reflection_Assembly_GetTypes): ditto.
+
+       * loader.c (mono_loader_clear_error): Fix indentation.
+
 2006-12-28  Martin Baulig  <[EMAIL PROTECTED]>
 
        * mono-debug.h (MONO_DEBUGGER_VERSION): Bump to 58.

Modified: trunk/mono/mono/metadata/icall.c
===================================================================
--- trunk/mono/mono/metadata/icall.c    2007-01-01 22:39:12 UTC (rev 70329)
+++ trunk/mono/mono/metadata/icall.c    2007-01-02 02:02:29 UTC (rev 70330)
@@ -1080,8 +1080,14 @@
        type = type_from_name (str, ignoreCase);
        g_free (str);
        if (type == NULL){
+               MonoException *e = NULL;
+               
                if (throwOnError)
-                       mono_raise_exception (mono_get_exception_type_load 
(name, NULL));
+                       e = mono_get_exception_type_load (name, NULL);
+
+               mono_loader_clear_error ();
+               if (e != NULL)
+                       mono_raise_exception (e);
        }
        
        return type;
@@ -3792,9 +3798,16 @@
        g_list_free (info.modifiers);
        g_list_free (info.nested);
        if (!type) {
+               MonoException *e = NULL;
+               
                if (throwOnError)
-                       mono_raise_exception (mono_get_exception_type_load 
(name, NULL));
-               /* g_print ("failed find\n"); */
+                       e = mono_get_exception_type_load (name, NULL);
+
+               mono_loader_clear_error ();
+
+               if (e != NULL)
+                       mono_raise_exception (e);
+
                return NULL;
        }
 
@@ -3804,6 +3817,7 @@
                if (throwOnError && klass->exception_type) {
                        /* report SecurityException (or others) that occured 
when loading the assembly */
                        MonoException *exc = 
mono_class_get_exception_for_failure (klass);
+                       mono_loader_clear_error ();
                        mono_raise_exception (exc);
                } else if (klass->exception_type == 
MONO_EXCEPTION_SECURITY_INHERITANCEDEMAND) {
                        return NULL;
@@ -4736,6 +4750,7 @@
                list = NULL;
 
                exc = mono_get_exception_reflection_type_load (res, exl);
+               mono_loader_clear_error ();
                mono_raise_exception (exc);
        }
                

Modified: trunk/mono/mono/metadata/loader.c
===================================================================
--- trunk/mono/mono/metadata/loader.c   2007-01-01 22:39:12 UTC (rev 70329)
+++ trunk/mono/mono/metadata/loader.c   2007-01-02 02:02:29 UTC (rev 70330)
@@ -214,8 +214,8 @@
        MonoLoaderError *ex = (MonoLoaderError*)TlsGetValue 
(loader_error_thread_id);
 
        if (ex) {
-        g_free (ex->class_name);
-        g_free (ex->assembly_name);
+               g_free (ex->class_name);
+               g_free (ex->assembly_name);
                g_free (ex);
        
                TlsSetValue (loader_error_thread_id, NULL);

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

Reply via email to