Subject: bug#17392: 24.3.90; cursor blinks faster and faster

From: Michael Heerdegen <[email-masked]>
Date: Wed, 14 May 2014 17:36:46 +0200

Eli Zaretskii <[email-masked]> writes:

> Actually, this is inaccurate: blink-cursor-timer-function, which runs
> off a regular (non-idle) timer, sometimes calls blink-cursor-suspend,
> which cancels the blink-cursor-idle-timer.
>
> But this looks perfectly normal, and indeed if Michael's advice runs
> when the idle timer expired, it might find that the idle timer that
> runs was already deleted from timer-idle-list, because we invoke the
> timers from a copy of the list.  If this is what happens, then what
> Michael's code reveals is an artifact of a perfectly normal and
> expected operation.

Could something the following happen?

1.  blink-cursor-idle-timer is bound to the only idle blink timer,
    everything is fine.

2.  timer-idle-list is `copy-sequenc'ed.

3.  The idle timer is canceled.  `blink-cursor-idle-timer' is now bound
to nil.

4.  The old timer from 2. is called with timer-event-handler.
Note that as a side effect, the timer is pushed back to timer-idle-list,
but `blink-cursor-idle-timer' is still bound to nil.

5.  `blink-cursor-check' is run.  It sees that `blink-cursor-idle-timer'
is nil and starts another idle timer.

Michael.