diff options
author | Tom Tromey <tromey@adacore.com> | 2022-03-15 12:55:51 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2022-03-15 12:59:00 -0600 |
commit | cda8dc94dfff823bf0284e5140c6065f143a9f51 (patch) | |
tree | 6035f1bba80ab1990165c8b36532665e8d424352 | |
parent | af481f01297a61af30f3f3dbaa11e6636c587dcb (diff) | |
download | binutils-cda8dc94dfff823bf0284e5140c6065f143a9f51.zip binutils-cda8dc94dfff823bf0284e5140c6065f143a9f51.tar.gz binutils-cda8dc94dfff823bf0284e5140c6065f143a9f51.tar.bz2 |
Fix bug in dwarf-mode.el
I noticed that, occasionally, dwarf-mode would think that the objdump
subprocess was still running after it had clearly exited. I managed
to reliably reproduce this today and learned that a process sentinel
is not guaranteed to be run with the current buffer set to the process
buffer. This patch fixes the problem.
I've bumped the version number of dwarf-mode.el to make it easier to
install for users who already have an earlier one installed.
I'm checking this in.
2022-03-15 Tom Tromey <tromey@adacore.com>
* dwarf-mode.el: Now 1.7.
(dwarf--sentinel): Switch to the process buffer.
-rw-r--r-- | binutils/ChangeLog | 5 | ||||
-rw-r--r-- | binutils/dwarf-mode.el | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 539849c..f717e0c 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2022-03-15 Tom Tromey <tromey@adacore.com> + + * dwarf-mode.el: Now 1.7. + (dwarf--sentinel): Switch to the process buffer. + 2022-03-11 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> * MAINTAINERS: Add gprofng maintainer. diff --git a/binutils/dwarf-mode.el b/binutils/dwarf-mode.el index 11aeb1f..9df875c 100644 --- a/binutils/dwarf-mode.el +++ b/binutils/dwarf-mode.el @@ -1,6 +1,6 @@ ;;; dwarf-mode.el --- Browser for DWARF information. -*-lexical-binding:t-*- -;; Version: 1.6 +;; Version: 1.7 ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. @@ -62,9 +62,11 @@ (set-marker (process-mark proc) (point)) (set-buffer-modified-p nil)))))) -(defun dwarf--sentinel (_proc _status) - (setq mode-line-process nil) - (setq dwarf--process nil)) +(defun dwarf--sentinel (proc _status) + (when (buffer-live-p (process-buffer proc)) + (with-current-buffer (process-buffer proc) + (setq mode-line-process nil) + (setq dwarf--process nil)))) (defun dwarf--invoke (start end &rest command) "Invoke a command and arrange to insert output into the current buffer." |