[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#6177: 23.2; emacs crashes when reverting a file
From: |
Roland Winkler |
Subject: |
bug#6177: 23.2; emacs crashes when reverting a file |
Date: |
Wed, 12 May 2010 16:13:10 -0500 |
On Wed May 12 2010 Eli Zaretskii wrote:
> > I've encountered a situation, where reverting a file reproducibly
> > crashes emacs. I do not know much about debugging emacs on this level.
> > I've reproduced the crash under gdb.
> > xbacktrace doesn't give any information.
>
> Can you show the steps to reproduce this, starting with "emacs -Q"?
I got a simpler test case that works with emacs -Q.
The point about the code below is that buffer *bar* depends on what
happens to file foo.txt visited in its own buffer: reverting buffer
*bar* really operates on the buffer visiting foo.txt.
The detailed steps to reprdouce this bug are as follows:
Create file foo.txt
cat > ~/foo.txt <<EOF
Hello world.
EOF
In "emacs -Q" load the code below. Then run my-init, touch file
foo.txt and finally move point in buffer bar which triggers
my-revert-buffer. This crashes emacs.
If the second with-current-buffer is removed from my-revert-buffer
the code runs fine.
Roland
(setq my-buffer "foo.txt")
(defun my-init ()
(interactive)
(find-file (concat "~/" my-buffer))
(my-bar))
(defun my-bar ()
(with-current-buffer (get-buffer-create "*bar*")
(erase-buffer)
(insert "acdef")
(setq revert-buffer-function 'my-revert-buffer
mode-line-buffer-identification
(list 24 (buffer-name) " "
'(:eval (format "%d" (my-revert-buffer)))))
(add-hook 'post-command-hook 'force-mode-line-update nil t)))
(defun my-revert-buffer (&optional ignore-auto noconfirm)
"My `revert-buffer-function'."
(when (or noconfirm
(not (verify-visited-file-modtime (get-buffer my-buffer))))
(with-current-buffer my-buffer
(kill-all-local-variables)
(let (revert-buffer-function) ; don't loop.
(revert-buffer ignore-auto t)))
;; the following two lines make emacs crash
(with-current-buffer (get-buffer-create "*bar*")
(erase-buffer)))
0)