Made `dolist` push `lst` to gc stack with each iteration

Required as in instances where a function rebinds itself during
its own execution, the body of the previous version of it could
become unreachable and get garbage collected while it was still
trying to execute
This commit is contained in:
rxi 2019-09-28 17:20:01 +01:00
parent 9569f9309b
commit 1457d9f338
1 changed files with 1 additions and 0 deletions

View File

@ -573,6 +573,7 @@ static fe_Object* dolist(fe_Context *ctx, fe_Object *lst, fe_Object *env) {
int save = fe_savegc(ctx);
while (!isnil(lst)) {
fe_restoregc(ctx, save);
fe_pushgc(ctx, lst);
fe_pushgc(ctx, env);
res = eval(ctx, fe_nextarg(ctx, &lst), env, &env);
}