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

From: Eli Zaretskii <[email-masked]>
Date: Tue, 01 Sep 2015 18:03:47 +0300

> Date: Tue, 1 Sep 2015 10:20:11 +0000
> From: Pip Cet <[email-masked]>
> Cc: [email-masked]
> 
>     Can you show a patch that fixes the original segfault in your use
>     case?
> 
> Attached.

Hmm... isn't that a kludge?  Or am I missing something?  I thought you
intended to recalculate the length on each iteration?

> I think we should fix three things:
> - concat shouldn't rely on its argument remaining unchanged in length
> - the timer list copy should happen with block_input/unblock_input wrapped
> around it
> - we shouldn't call do_pending_window_change from QUIT [already installed.
> Thanks, martin!]
> 
> Any one of these is enough to prevent the original segfault. All but the second
> also prevent the bizarre-elisp-induced segfault I came up with later.

I think we should make all of these changes.

> I'm not sure whether the timer code in timer.el does anything to the
> timer list that might count as dangerous, but that's possibly the
> only legitimate Lisp user of timer-list.

Indeed.  And if it does something unsafe, we should fix that.