Subject: bug#21380: 25.0.50; GTK-induced segfault when scheduling timer from window-configuration-change-hook

From: Stefan Monnier <[email-masked]>
Date: Thu, 03 Sep 2015 11:36:44 -0400

>> So maybe we should introduce a special copy_sequence_no_quit function
>> that never calls QUIT, and then use it for copying the timer lists.

That'd be OK, yes.  This said, maybe an even better solution would be to
avoid the copy altogether.

AFAICT these lists are only ever side-effected by timer.el's
timer--activate, which has a special `reuse-cell' argument just to be
able to do that.

I'm not completely sure why we do it this way, but my naive
understanding is the following:
- For historical reasons of limited resources, timer.el tries hard to
  avoid allocating cons cells.
- Then many years later we found a problem with this cell-reuse and
  circumvented it by copying the whole list all the time.
- So we end up working hard to avoid allocating a couple cells on one
  side, only to end up allocating many more on the other.

Maybe we should go back to bugs #12447 and #12326 and see if just
removing the "reuse-cell" code (and the Fcopy_sequence(s)) fixes the
problem as well.

        Stefan