[Mono-list] Finalization cycle involving ... errors
Adam Treat
manyoso@yahoo.com
Sun, 10 Nov 2002 13:09:52 -0400
About the "Finalization cycle involving ... " errors.
The fix is to replace the 'GC_register_finalizer' call in
mono/mono/metadata/gc.c with 'GC_register_finalizer_no_order'. According to
the source documentation in boehm GC, the 'no_order' call is:
/*
* A version of GC_register_finalizer that allows the object to be
* finalized before the objects it references. This is again error
* prone, in that it makes it easy to accidentally reference finalized
* objects. Again, recommended only for JVM implementors.
*/
I believe this applies to the .NET/CLR as well as the JVM, but am not
completely sure. This eliminates those errors in Qt# though ...
Here is the trivial patch ;)
Index: gc.c
===================================================================
RCS file: /cvs/public/mono/mono/metadata/gc.c,v
retrieving revision 1.18
diff -u -3 -p -u -r1.18 gc.c
--- gc.c 11 Oct 2002 20:24:11 -0000 1.18
+++ gc.c 10 Nov 2002 16:58:49 -0000
@@ -69,7 +69,7 @@ object_register_finalizer (MonoObject *o
guint offset = 0;
g_assert (GC_base (obj) == (char*)obj - offset);
- GC_register_finalizer ((char*)obj - offset, callback, GUINT_TO_POINTER
(offset), NULL, NULL);
+ GC_register_finalizer_no_order ((char*)obj - offset, callback,
GUINT_TO_POINTER (offset), NULL, NULL);
#endif
}
Cheers,
Adam