aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2018-10-14 09:51:32 -0700
committerPaul Eggert2018-10-14 09:54:58 -0700
commitf1ea2b9e6b63593f5919f60a68a9e19026756ac4 (patch)
tree1142c633f473532373ca0c61074767c9731fde73 /src
parentf3c13bb38e4120b4b84623892c6df4ddb421d5d0 (diff)
downloademacs-f1ea2b9e6b63593f5919f60a68a9e19026756ac4.tar.gz
emacs-f1ea2b9e6b63593f5919f60a68a9e19026756ac4.zip
Fix lisp_eval_depth in unwind-protect cleanup
Problem reported by Paul Pogonyshev (Bug#33034). * src/lisp.h (union specbinding): New member unwind.eval_depth. * src/eval.c (record_unwind_protect, set_unwind_protect): Set it. (do_one_unbind): Use it.
Diffstat (limited to 'src')
-rw-r--r--src/eval.c3
-rw-r--r--src/lisp.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c
index 42c275de6bc..a51d0c90831 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3429,6 +3429,7 @@ record_unwind_protect (void (*function) (Lisp_Object), Lisp_Object arg)
3429 specpdl_ptr->unwind.kind = SPECPDL_UNWIND; 3429 specpdl_ptr->unwind.kind = SPECPDL_UNWIND;
3430 specpdl_ptr->unwind.func = function; 3430 specpdl_ptr->unwind.func = function;
3431 specpdl_ptr->unwind.arg = arg; 3431 specpdl_ptr->unwind.arg = arg;
3432 specpdl_ptr->unwind.eval_depth = lisp_eval_depth;
3432 grow_specpdl (); 3433 grow_specpdl ();
3433} 3434}
3434 3435
@@ -3501,6 +3502,7 @@ do_one_unbind (union specbinding *this_binding, bool unwinding,
3501 switch (this_binding->kind) 3502 switch (this_binding->kind)
3502 { 3503 {
3503 case SPECPDL_UNWIND: 3504 case SPECPDL_UNWIND:
3505 lisp_eval_depth = this_binding->unwind.eval_depth;
3504 this_binding->unwind.func (this_binding->unwind.arg); 3506 this_binding->unwind.func (this_binding->unwind.arg);
3505 break; 3507 break;
3506 case SPECPDL_UNWIND_ARRAY: 3508 case SPECPDL_UNWIND_ARRAY:
@@ -3595,6 +3597,7 @@ set_unwind_protect (ptrdiff_t count, void (*func) (Lisp_Object),
3595 p->unwind.kind = SPECPDL_UNWIND; 3597 p->unwind.kind = SPECPDL_UNWIND;
3596 p->unwind.func = func; 3598 p->unwind.func = func;
3597 p->unwind.arg = arg; 3599 p->unwind.arg = arg;
3600 p->unwind.eval_depth = lisp_eval_depth;
3598} 3601}
3599 3602
3600void 3603void
diff --git a/src/lisp.h b/src/lisp.h
index 5ecc48b025c..a7a26ef350e 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3071,6 +3071,7 @@ union specbinding
3071 ENUM_BF (specbind_tag) kind : CHAR_BIT; 3071 ENUM_BF (specbind_tag) kind : CHAR_BIT;
3072 void (*func) (Lisp_Object); 3072 void (*func) (Lisp_Object);
3073 Lisp_Object arg; 3073 Lisp_Object arg;
3074 EMACS_INT eval_depth;
3074 } unwind; 3075 } unwind;
3075 struct { 3076 struct {
3076 ENUM_BF (specbind_tag) kind : CHAR_BIT; 3077 ENUM_BF (specbind_tag) kind : CHAR_BIT;