summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-01-06 22:47:42 -0800
committerKaz Kylheku <kaz@kylheku.com>2024-01-06 22:47:42 -0800
commit5464e5ab1ae7d1eeba1dfbea36bc5e81714d1694 (patch)
tree79a45d2cc0855ffa56de1291b827812f6a03bda0
parenta0ab563c96bb9b96bce3c5f24af71b821bacdfde (diff)
downloadtxr-5464e5ab1ae7d1eeba1dfbea36bc5e81714d1694.tar.gz
txr-5464e5ab1ae7d1eeba1dfbea36bc5e81714d1694.tar.bz2
txr-5464e5ab1ae7d1eeba1dfbea36bc5e81714d1694.zip
eval: potential gc problem in binding.
* eval.c (reparent_env): This function is used in bindings helper, when special variables are involved. It makes a new environment the parent of an existing one, just by assigning the pointer. This is wrong under generational GC if it makes a mature object point to a new object. We fix it with the set macro. I've not seen a crash because of this; I caught it by inspection.
-rw-r--r--eval.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index 26f4b701..1846c348 100644
--- a/eval.c
+++ b/eval.c
@@ -759,7 +759,7 @@ static val lookup_symac_lisp1(val menv, val sym)
static val reparent_env(val child, val parent)
{
- child->e.up_env = parent;
+ set(mkloc(child->e.up_env, child), parent);
return child;
}