]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix lisp_eval_depth in unwind-protect cleanup
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 14 Oct 2018 16:51:32 +0000 (09:51 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 14 Oct 2018 16:54:58 +0000 (09:54 -0700)
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.

src/eval.c
src/lisp.h

index 42c275de6bc61d18426fc8b3bd6222adb5b18e98..a51d0c90831fd8ae74b6f042a334a9a16466bb2d 100644 (file)
@@ -3429,6 +3429,7 @@ record_unwind_protect (void (*function) (Lisp_Object), Lisp_Object arg)
   specpdl_ptr->unwind.kind = SPECPDL_UNWIND;
   specpdl_ptr->unwind.func = function;
   specpdl_ptr->unwind.arg = arg;
+  specpdl_ptr->unwind.eval_depth = lisp_eval_depth;
   grow_specpdl ();
 }
 
@@ -3501,6 +3502,7 @@ do_one_unbind (union specbinding *this_binding, bool unwinding,
   switch (this_binding->kind)
     {
     case SPECPDL_UNWIND:
+      lisp_eval_depth = this_binding->unwind.eval_depth;
       this_binding->unwind.func (this_binding->unwind.arg);
       break;
     case SPECPDL_UNWIND_ARRAY:
@@ -3595,6 +3597,7 @@ set_unwind_protect (ptrdiff_t count, void (*func) (Lisp_Object),
   p->unwind.kind = SPECPDL_UNWIND;
   p->unwind.func = func;
   p->unwind.arg = arg;
+  p->unwind.eval_depth = lisp_eval_depth;
 }
 
 void
index 5ecc48b025c7420f0b2f46d2ef21ea79dc156adb..a7a26ef350ec84e7a4ca04e61dd763028f950dd0 100644 (file)
@@ -3071,6 +3071,7 @@ union specbinding
       ENUM_BF (specbind_tag) kind : CHAR_BIT;
       void (*func) (Lisp_Object);
       Lisp_Object arg;
+      EMACS_INT eval_depth;
     } unwind;
     struct {
       ENUM_BF (specbind_tag) kind : CHAR_BIT;