Fri Oct 6 16:57:26 CEST 2006 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Fri, 6 Oct 2006 14:58:18 +0000 (14:58 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Fri, 6 Oct 2006 14:58:18 +0000 (14:58 -0000)
* gc.c: do not allow the user to SuppressFinalize () a
delegate because it would leak the trampoline if present.

svn path=/trunk/mono/; revision=66356

mono/metadata/ChangeLog
mono/metadata/gc.c

index dec4af3e9024a66a67a885b5d5f9d8cab152c641..e0865b27c18c0066af648620d23ff1829350c267 100644 (file)
@@ -1,3 +1,9 @@
+
+Fri Oct 6 16:57:26 CEST 2006 Paolo Molaro <lupus@ximian.com>
+
+       * gc.c: do not allow the user to SuppressFinalize () a
+       delegate because it would leak the trampoline if present.
+
 2006-10-06  Zoltan Varga  <vargaz@gmail.com>
 
        * class.c metadata.c row-indexes.h blob.h: Applied patch from Jb. Add support for the
index 7dc5de072b24db2f7f0cc1c7ae22b22e4bff921f..15f8b50cfcaef7b5bec4c60b3e4491e21f877036 100644 (file)
@@ -282,6 +282,13 @@ ves_icall_System_GC_SuppressFinalize (MonoObject *obj)
 {
        MONO_ARCH_SAVE_REGS;
 
+       /* delegates have no finalizers, but we register them to deal with the
+        * unmanaged->managed trampoline. We don't let the user suppress it
+        * otherwise we'd leak it.
+        */
+       if (obj->vtable->klass->delegate)
+               return;
+
        object_register_finalizer (obj, NULL);
 }