Author: zoltan
Date: 2007-09-14 10:42:28 -0400 (Fri, 14 Sep 2007)
New Revision: 85805

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/gc.c
Log:
2007-09-14  Zoltan Varga  <[EMAIL PROTECTED]>

        * gc.c (ves_icall_System_GCHandle_GetAddrOfPinnedObject): Use a return 
value of
        -2 to communicate to managed code that the handle is not pinned. Fixes 
#82848.


Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2007-09-14 14:41:02 UTC (rev 85804)
+++ trunk/mono/mono/metadata/ChangeLog  2007-09-14 14:42:28 UTC (rev 85805)
@@ -1,4 +1,8 @@
+2007-09-14  Zoltan Varga  <[EMAIL PROTECTED]>
 
+       * gc.c (ves_icall_System_GCHandle_GetAddrOfPinnedObject): Use a return 
value of
+       -2 to communicate to managed code that the handle is not pinned. Fixes 
#82848.
+
 Fri Sep 14 14:04:31 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>
 
        * icall-def.h, string-icalls.c: get rid of old, no longer used, string

Modified: trunk/mono/mono/metadata/gc.c
===================================================================
--- trunk/mono/mono/metadata/gc.c       2007-09-14 14:41:02 UTC (rev 85804)
+++ trunk/mono/mono/metadata/gc.c       2007-09-14 14:42:28 UTC (rev 85805)
@@ -346,6 +346,8 @@
 
 static void mono_gchandle_set_target (guint32 gchandle, MonoObject *obj);
 
+static HandleType mono_gchandle_get_type (guint32 gchandle);
+
 MonoObject *
 ves_icall_System_GCHandle_GetTarget (guint32 handle)
 {
@@ -389,6 +391,8 @@
 {
        MonoObject *obj;
 
+       if (mono_gchandle_get_type (handle) != HANDLE_PINNED)
+               return (gpointer)-2;
        obj = mono_gchandle_get_target (handle);
        if (obj) {
                MonoClass *klass = mono_object_class (obj);
@@ -582,6 +586,14 @@
        return alloc_handle (&gc_handles [track_resurrection? 
HANDLE_WEAK_TRACK: HANDLE_WEAK], obj);
 }
 
+static HandleType
+mono_gchandle_get_type (guint32 gchandle)
+{
+       guint type = (gchandle & 7) - 1;
+
+       return type;
+}
+
 /**
  * mono_gchandle_get_target:
  * @gchandle: a GCHandle's handle.

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

Reply via email to