Skip to content

Commit

Permalink
Save/restore arena index in the loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Mar 4, 2017
1 parent ffdf7be commit c789acb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/backtrace.c
Expand Up @@ -229,10 +229,11 @@ print_backtrace(mrb_state *mrb, mrb_value backtrace)
static void
print_backtrace_saved(mrb_state *mrb)
{
int i;
int i, ai;
FILE *stream = stderr;

fprintf(stream, "trace:\n");
ai = mrb_gc_arena_save(mrb);
for (i = 0; i < mrb->backtrace.n; i++) {
mrb_backtrace_entry *entry;

Expand All @@ -252,6 +253,7 @@ print_backtrace_saved(mrb_state *mrb)
else {
fprintf(stream, ":in %s", method_name);
}
mrb_gc_arena_restore(mrb, ai);
}

fprintf(stream, "\n");
Expand Down

0 comments on commit c789acb

Please sign in to comment.