I was experiencing a semi-regular failure of an error checking XEmacs
while reading items with Gnus that I tracked down to being caused by
To rotate the animation, XEmacs registers a timeout for them and, in the
image finalize method, cancels the timeout.
Unfortunately, the method that cancels the timeout will synchronously
free a wide range of Lisp objects, which causes heartburn for the GC
system -- an assert and, presumably, the risk of a genuine crash without
This crash is common to all platforms, as they all use the same common
code to actually cancel the image timeout.
The solution I have implemented in this patch is to modify the common
method. Now, rather than immediately cancel the timeout, that common
code will register a suitable post-GC action to cancel the timeout once
we are safely outside the danger zone.
This keeps the change to a single file, and avoids needing to embed more
tricky timing logic into the three GUI branches that would then need to
be kept in sync.
This is recommended for 21.5 as well as HEAD because the same problem is
present on both sides.