public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: binutils@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [pushed] Fix bug in dwarf-mode.el
Date: Tue, 15 Mar 2022 12:58:41 -0600	[thread overview]
Message-ID: <20220315185841.1289714-1-tromey@adacore.com> (raw)

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.

binutils/ChangeLog
2022-03-15  Tom Tromey  <tromey@adacore.com>

	* dwarf-mode.el: Now 1.7.
	(dwarf--sentinel): Switch to the process buffer.
---
 binutils/ChangeLog     |  5 +++++
 binutils/dwarf-mode.el | 10 ++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/binutils/dwarf-mode.el b/binutils/dwarf-mode.el
index 11aeb1f79fd..9df875ca4fe 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."
-- 
2.34.1


                 reply	other threads:[~2022-03-15 18:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220315185841.1289714-1-tromey@adacore.com \
    --to=tromey@adacore.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).