changeset 19588:f51f46bef183

(timer-event-handler): Reactivate timer first, then run the handler function.
author Richard M. Stallman <rms@gnu.org>
date Thu, 28 Aug 1997 01:03:17 +0000
parents 7d59cb04d2d9
children 8c19d570a391
files lisp/timer.el
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/timer.el	Thu Aug 28 00:33:03 1997 +0000
+++ b/lisp/timer.el	Thu Aug 28 01:03:17 1997 +0000
@@ -264,10 +264,6 @@
 	(progn
 	  ;; Delete from queue.
 	  (cancel-timer timer)
-	  ;; Run handler
-	  (condition-case nil
-	      (apply (aref timer 5) (aref timer 6))
-	    (error nil))
 	  ;; Re-schedule if requested.
 	  (if (aref timer 4)
 	      (if (aref timer 7)
@@ -282,7 +278,13 @@
 				      (aref timer 4))))
 		      (if (> repeats timer-max-repeats)
 			  (timer-inc-time timer (* (aref timer 4) repeats)))))
-		(timer-activate timer))))
+		(timer-activate timer)))
+	  ;; Run handler.
+	  ;; We do this after rescheduling so that the handler function
+	  ;; can cancel its own timer successfully with cancel-timer.
+	  (condition-case nil
+	      (apply (aref timer 5) (aref timer 6))
+	    (error nil)))
       (error "Bogus timer event"))))
 
 ;; This function is incompatible with the one in levents.el.