From aa23766df20014bda49bcc03217884bb335a74dc Mon Sep 17 00:00:00 2001 From: slava Date: Tue, 21 Nov 2006 21:19:17 +0000 Subject: [PATCH] Fix issue when GC is called while allocating native stack trace --- TODO.FACTOR.txt | 1 - vm/run.c | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 0896d4c971..fe4d6f10ab 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -1,6 +1,5 @@ + 0.87: -- thrown_* vars are not gc roots - "ker" C+u: for a moment, full vocab list is shown - : foo \ each reload foo ; foo eventually crashes - list usability diff --git a/vm/run.c b/vm/run.c index 17cc2d123f..269a915142 100644 --- a/vm/run.c +++ b/vm/run.c @@ -256,7 +256,8 @@ void early_error(CELL error) } } -CELL native_stack_trace(void) +/* allocates memory */ +CELL allot_native_stack_trace(void) { F_STACK_FRAME *frame = native_stack_pointer(); GROWABLE_ARRAY(array); @@ -285,12 +286,15 @@ void throw_error(CELL error, bool keep_stacks) { early_error(error); + REGISTER_ROOT(error); + thrown_native_stack_trace = allot_native_stack_trace(); + UNREGISTER_ROOT(error); + throwing = true; thrown_error = error; thrown_keep_stacks = keep_stacks; thrown_ds = ds; thrown_rs = rs; - thrown_native_stack_trace = native_stack_trace(); /* Return to interpreter() function */ LONGJMP(stack_chain->toplevel,1);