From 0e1d0226b211f68d71c21ea9243bc94c2c879fb1 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Sat, 18 Feb 2012 10:47:58 +0100 Subject: [PATCH] Explicitly mark the current thread environment, just in case it was not properly installed in cl_core.processes (this happens when registering external threads). --- src/c/alloc_2.d | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/c/alloc_2.d b/src/c/alloc_2.d index 4bd839be1..0b52214f3 100755 --- a/src/c/alloc_2.d +++ b/src/c/alloc_2.d @@ -1284,6 +1284,7 @@ ecl_mark_env(struct cl_env_struct *env) static void stacks_scanner() { + cl_env_ptr the_env = ecl_process_env(); cl_object l; l = cl_core.libraries; if (l) { @@ -1297,20 +1298,17 @@ stacks_scanner() } GC_push_all((void *)(&cl_core), (void *)(&cl_core + 1)); GC_push_all((void *)cl_symbols, (void *)(cl_symbols + cl_num_symbols_in_core)); + if (the_env != NULL) + ecl_mark_env(the_env); #ifdef ECL_THREADS l = cl_core.processes; - if (l == OBJNULL) { - ecl_mark_env(&cl_env); - } else { - l = cl_core.processes; + if (l != OBJNULL) { loop_for_on_unsafe(l) { cl_object process = ECL_CONS_CAR(l); - struct cl_env_struct *env = process->process.env; - ecl_mark_env(env); + cl_env_ptr env = process->process.env; + if (env != the_env) ecl_mark_env(env); } end_loop_for_on_unsafe(l); } -#else - ecl_mark_env(&cl_env); #endif if (old_GC_push_other_roots) (*old_GC_push_other_roots)();