Subject: Re: bug#40418: 28.0.50; ERC quit server causes error in `erc-server-send-queue` timer

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 02 Aug 2020 07:49:46 +0200

Narendra Joshi <[email-masked]> writes:

> Using `erc-quit-server' command causes the following error:
>
> Debugger entered--Lisp error: (error "Selecting deleted buffer")
>   erc-server-send-queue(#<killed buffer>)
>   apply(erc-server-send-queue #<killed buffer>)
>   timer-event-handler([t 24199 41423 723955 nil 
>   erc-server-send-queue (#<killed buffer>) nil 886000])
>
> The timer responsible for sending the message should have been 
> cancelled before killing the buffer that is being passed to 
> `erc-server-send-queue' function.  

If I'm reading the code correctly, the timer is only set in a variable
buffer-local to the killed buffer itself, so killing the timer isn't
trivial.  Instead I've made erc-server-send-queue check that the buffer
is live before trying to use it, which I think should fix this.

(Applied to Emacs 28.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no