2003-05-12 Dick Porter <dick@ximian.com>
authorDick Porter <dick@acm.org>
Mon, 12 May 2003 15:12:24 +0000 (15:12 -0000)
committerDick Porter <dick@acm.org>
Mon, 12 May 2003 15:12:24 +0000 (15:12 -0000)
* gc.c: Don't run finalizers when the finalizer thread is
finishing up, because the default domain has already been
destroyed.

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

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

index 142fad1512173a0480738bb247ed9cb83a22b358..3bf00987d4159205a86cbbe44a78e9a648ffa5c3 100644 (file)
@@ -1,3 +1,9 @@
+2003-05-12  Dick Porter  <dick@ximian.com>
+
+       * gc.c: Don't run finalizers when the finalizer thread is
+       finishing up, because the default domain has already been
+       destroyed.
+
 2003-05-11  Miguel de Icaza  <miguel@ximian.com>
 
        * string-icalls.c (ves_icall_System_String_ctor_chara_int_int): if
index 5156a218c1f9d26fb0585d01cb4330551234e2e3..9f6d8708e652e0099804aa863f2a26d1a31685cc 100644 (file)
@@ -179,7 +179,6 @@ mono_domain_finalize (MonoDomain *domain)
         * No need to create another thread 'cause the finalizer thread
         * is still working and will take care of running the finalizers
         */ 
-       mono_thread_new_init (GetCurrentThreadId (), todo, NULL);
        
 #if HAVE_BOEHM_GC
        GC_gcollect ();
@@ -468,14 +467,17 @@ static guint32 finalizer_thread (gpointer unused)
                g_message (G_GNUC_PRETTY_FUNCTION ": invoking finalizers");
 #endif
 
-               /*
+               /* Can't run finalizers if we're finishing up, because the
+                * domain has already been destroyed
+                *
                 * There is a bug in GC_invoke_finalizer () in versions <= 6.2alpha4:
                 * the 'mem_freed' variable is not initialized when there are no
                 * objects to finalize, which leads to strange behavior later on.
                 * The check is necessary to work around that bug.
                 */
-               if (GC_should_invoke_finalizers ())
+               if(!finished && GC_should_invoke_finalizers ()) {
                        GC_invoke_finalizers ();
+               }
                SetEvent (pending_done_event);
        }