From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by sourceware.org (Postfix) with ESMTPS id B89643858D20 for ; Tue, 15 Mar 2022 18:58:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B89643858D20 Received: by mail-io1-xd2e.google.com with SMTP id e22so23357716ioe.11 for ; Tue, 15 Mar 2022 11:58:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Qqi0B08r+qyrx5s31XmXVMmXy3ueeZBDXhddIio50jI=; b=eu6hFrNZ2k/+hotO1/8DtJVsSIU2tXPnCtw9wpEDQnL/36a/4Iigfrkepaf+qQ1/Dd ft9PU+WEqEj+1lgQQj85enf3FB35hc5gjnLF8p/LA6fTKjc5loKLiWCXRx6ZEgJnOmri QMn0YUOfGp0xtvUDUAi7JgmgQPvfZnN28vD9qIQZjrO/A5nQ9ccGKwFJ/v8xTKzfl2Xn EUJgxDS4xCWKRY7dXH0SKFkrTvEVdtmY54b6v0ww1Zfv6pPMslQNxtrPHoCpCNvG+8HD GIwg58fwG80SwDMvwYLbPMSLp7FC9tUlmHMZ4+TT0mCOjbGSBNNoZXYAuLu0bxRFqiWa T7Kg== X-Gm-Message-State: AOAM531lnHOu3NR5qmjHt592SmZyqB2v4Dem5yxYMLZsLr3rmFgg/K4a B24tCNT3saEq4DcnKKiKARGgmwWzOd1brw== X-Google-Smtp-Source: ABdhPJwevOPlOfN+57HZOkrRkZWpIMR36GOwE8ENmExrxzLFcjnDFxaC5Mh7aZ1VjFa4CFlCw4tnzQ== X-Received: by 2002:a02:8811:0:b0:319:aef4:b545 with SMTP id r17-20020a028811000000b00319aef4b545mr24543942jai.152.1647370727035; Tue, 15 Mar 2022 11:58:47 -0700 (PDT) Received: from murgatroyd.Home (71-211-175-224.hlrn.qwest.net. [71.211.175.224]) by smtp.gmail.com with ESMTPSA id l14-20020a056e0205ce00b002c782f5e905sm6734667ils.74.2022.03.15.11.58.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Mar 2022 11:58:46 -0700 (PDT) From: Tom Tromey To: binutils@sourceware.org Cc: Tom Tromey Subject: [pushed] Fix bug in dwarf-mode.el Date: Tue, 15 Mar 2022 12:58:41 -0600 Message-Id: <20220315185841.1289714-1-tromey@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2022 18:58:49 -0000 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 * 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