emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 38f9d9bf06: ; * src/keyboard.c (timer_check_2): Restore run-time


From: Eli Zaretskii
Subject: master 38f9d9bf06: ; * src/keyboard.c (timer_check_2): Restore run-time conditions.
Date: Tue, 9 Aug 2022 14:27:26 -0400 (EDT)

branch: master
commit 38f9d9bf060e08f3fe5edab9a13bc7eaabe7e2f1
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    ; * src/keyboard.c (timer_check_2): Restore run-time conditions.
---
 src/keyboard.c | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/keyboard.c b/src/keyboard.c
index f8e6ef748d..4ad6e4e6bd 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -4645,24 +4645,29 @@ timer_check_2 (Lisp_Object timers, Lisp_Object 
idle_timers)
          /* If we got here, presumably `decode_timer` has checked
              that this timer has not yet been triggered.  */
          eassert (NILP (AREF (chosen_timer, 0)));
-         specpdl_ref count = SPECPDL_INDEX ();
-         Lisp_Object old_deactivate_mark = Vdeactivate_mark;
+         /* In a production build, where assertions compile to
+            nothing, we still want to play it safe here.  */
+         if (NILP (AREF (chosen_timer, 0)))
+           {
+             specpdl_ref count = SPECPDL_INDEX ();
+             Lisp_Object old_deactivate_mark = Vdeactivate_mark;
 
-         /* Mark the timer as triggered to prevent problems if the lisp
-            code fails to reschedule it right.  */
-         ASET (chosen_timer, 0, Qt);
+             /* Mark the timer as triggered to prevent problems if the lisp
+                code fails to reschedule it right.  */
+             ASET (chosen_timer, 0, Qt);
 
-         specbind (Qinhibit_quit, Qt);
+             specbind (Qinhibit_quit, Qt);
 
-         call1 (Qtimer_event_handler, chosen_timer);
-         Vdeactivate_mark = old_deactivate_mark;
-         timers_run++;
-         unbind_to (count, Qnil);
+             call1 (Qtimer_event_handler, chosen_timer);
+             Vdeactivate_mark = old_deactivate_mark;
+             timers_run++;
+             unbind_to (count, Qnil);
 
-         /* Since we have handled the event,
-            we don't need to tell the caller to wake up and do it.  */
-          /* But the caller must still wait for the next timer, so
-             return 0 to indicate that.  */
+             /* Since we have handled the event,
+                we don't need to tell the caller to wake up and do it.  */
+             /* But the caller must still wait for the next timer, so
+                return 0 to indicate that.  */
+           }
 
          nexttime = make_timespec (0, 0);
           break;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]