GNU bug report logs - #65095
30.0.50; thread_check_current_buffer

Previous Next

Package: emacs;

Reported by: Helmut Eller <eller.helmut <at> gmail.com>

Date: Sat, 5 Aug 2023 12:52:01 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Helmut Eller <eller.helmut <at> gmail.com>
Cc: 65095 <at> debbugs.gnu.org
Subject: bug#65095: 30.0.50; thread_check_current_buffer
Date: Sat, 05 Aug 2023 16:11:47 +0300
> From: Helmut Eller <eller.helmut <at> gmail.com>
> Date: Sat, 05 Aug 2023 14:51:26 +0200
> 
> This test fails
> 
> (ert-deftest tmp-buf ()
>   (let (buf)
>     (with-temp-buffer
>       (setq buf (current-buffer))
>       (make-thread (lambda ())))
>     (should-not (buffer-live-p buf))))
> 
> when executed with
> 
>   emacs -Q --batch -l tmp-buf.el -f ert-run-tests-batch-and-exit
> 
> The reason seems to be, that thread_check_current_buffer returns true
> and hence kill_buffer simply returns without doing anything.
> 
> I don't understand why this check is there

How would kill-buffer know whether it's okay to kill a buffer that is
current in another thread?  When we kill the current buffer in the
current thread, we do quite a bit of juggling to replace it with some
other, and punt if not possible.  We also "do nothing" if the buffer
to be killed is the currently active minibuffer or the sole visible
buffer.  So this "do nothing" in this case is not without precedent,
and cannot be just removed without having some non-trivial code in its
stead, right?

> E.g. ert--run-test-internal uses with-temp-buffer too, so if
> make-thread is used in a test, the temporary buffers will hang around
> and pile up.

The tests should arrange for deleting the buffer when no longer
needed.  The simplest is to have the thread kill its current buffer
before it (the thread) exits.




This bug report was last modified 1 year and 343 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.