bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34847: 27.0.50; auto-revert-buffers occasionally selects a killed bu


From: Basil L. Contovounesios
Subject: bug#34847: 27.0.50; auto-revert-buffers occasionally selects a killed buffer
Date: Sat, 06 Apr 2019 02:55:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Dale Sedivec <dale@codefu.org> writes:

> Lately, while in the process of using Magit, I've frequently gotten
> "Selecting deleting buffer" errors.

Same here.

> I have global-auto-revert-mode on.  I *suspect* this happens because
> *something* kills a buffer between when auto-revert-buffers collects
> the list of buffers with (buffer-list) and when auto-revert-buffers
> starts its final traversal of buffers in bufs (which starts out as
> (buffer-list) in global-auto-revert-mode).

My case is slightly different.  I enable auto-revert-mode neither
locally nor globally, so Magit automatically enables
magit-auto-revert-mode instead.

This means that the killed buffers causing the auto-revert-buffers timer
to choke are present in auto-revert-buffer-list, rather than
(buffer-list).

Normally, killed buffers are removed from auto-revert-buffer-list thanks
to the local kill-buffer-hook function
auto-revert-remove-current-buffer.

But instrumenting get-buffer-create and kill-buffer revealed that
kill-buffer-hook wasn't run sometimes, specifically when an
uninitialised inhibit_buffer_hooks happened to be non-zero.

Eli, is the following TRT?

>From 3c519bd52911db44bb3f92dcc722812d8d69a2c6 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Sat, 6 Apr 2019 02:41:16 +0100
Subject: [PATCH] Don't leave inhibit_buffer_hooks uninitialized

* src/buffer.c (Fget_buffer_create): Explicitly initialize
inhibit_buffer_hooks. (bug#34847)
---
 src/buffer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/buffer.c b/src/buffer.c
index c0f7521c9e..c5d8ee2629 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -588,6 +588,8 @@ even if it is dead.  The return value is never nil.  */)
       && strncmp (SSDATA (name), SSDATA (Vcode_conversion_workbuf_name),
                  SBYTES (Vcode_conversion_workbuf_name)) == 0)
     b->inhibit_buffer_hooks = true;
+  else
+    b->inhibit_buffer_hooks = false;
 
   bset_undo_list (b, SREF (name, 0) != ' ' ? Qnil : Qt);
 
-- 
2.20.1

Between Michael's patch[1] for autorevert.el and this, I think the issue
should be solved.

[1]: https://debbugs.gnu.org/34847#8

Thanks,

-- 
Basil

reply via email to

[Prev in Thread] Current Thread [Next in Thread]