From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#65678: 30.0.50; EWW rendered errs when the EWW buffer is closed before the page gets loaded Date: Sat, 02 Sep 2023 11:00:10 +0300 Message-ID: <83ledp9f91.fsf@gnu.org> References: <87sf7yhuth.fsf@localhost> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24100"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65678@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 02 10:01:01 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qcLYy-00067y-Tf for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Sep 2023 10:01:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcLYr-0003L3-QG; Sat, 02 Sep 2023 04:00:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qcLYq-0003Kv-LV for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 04:00:52 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qcLYq-0000TP-CI for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 04:00:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qcLYz-0004Wl-KZ for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 04:01:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Sep 2023 08:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65678 X-GNU-PR-Package: emacs Original-Received: via spool by 65678-submit@debbugs.gnu.org id=B65678.169364164217371 (code B ref 65678); Sat, 02 Sep 2023 08:01:01 +0000 Original-Received: (at 65678) by debbugs.gnu.org; 2 Sep 2023 08:00:42 +0000 Original-Received: from localhost ([127.0.0.1]:35080 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcLYg-0004W7-9L for submit@debbugs.gnu.org; Sat, 02 Sep 2023 04:00:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51704) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcLYd-0004Vr-Fe for 65678@debbugs.gnu.org; Sat, 02 Sep 2023 04:00:40 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qcLYN-0000Mx-Is; Sat, 02 Sep 2023 04:00:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=+t6e8Wmdoi+go0R+iKg8A5pRxEwAngyIZKRAD9puV6o=; b=agtlS1xNWQiG APZLbWk2lVSgVekTXxjCQO/Aggty30eeEZf9b+eIAFZNg7kMgsZXecVoNqphCuo9hWEsUp2VDYgVQ OWO65BbV+XwhtXATvI1bNBlQyuxioiV4CVXkvYYpZaidGmehZcjYLaDni/E5d9uOu8SqsLqwF/V/b fXBgY+pf3FqRceuNd16h8QiacPBXXJV5z7Zk0PHaMD010bWsR/ducnZ3/23J6LxkuNZ3ZLm6duDif p2WdD5IG7VSjwXWoh9YLhZA6XbGmcXE34O7m4C2xhZn0BpzY3eDTx9PduABXSGh4raHoR51n8FyMP eRCcobPbAbOK6h3nISiizg==; In-Reply-To: <87sf7yhuth.fsf@localhost> (message from Ihor Radchenko on Fri, 01 Sep 2023 13:44:26 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:268965 Archived-At: > From: Ihor Radchenko > Date: Fri, 01 Sep 2023 13:44:26 +0000 > > When I quickly open and close a EWW page, I get the following error > after a while: > > Debugger entered--Lisp error: (error "Selecting deleted buffer") > (eww-render (:peer ...) "https://sfba.social/@kickingvegas/1109829258114145..." nil # nil) > (url-http-activate-callback) > (url-http-chunked-encoding-after-change-function 12257 12929 672) > (url-http-generic-filter # "\312V\5.-i\205KKZ\341R\236o;%.-\326/p)\357\317\0G\342Rx\33B\215(q\247b\277\200\245$G\337\360\306\335\352\364\5,-...") > > I'd expect no error to be thrown and the rendered silently stopping. I couldn't easily simulate that here (you didn't say what you do to "close a EWW page"), so would you please see if the change below gives good results? diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 089e481..b87e785 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -620,47 +620,48 @@ eww-render (let ((redirect (plist-get status :redirect))) (when redirect (setq url redirect))) - (with-current-buffer buffer - ;; Save the https peer status. - (plist-put eww-data :peer (plist-get status :peer)) - ;; Make buffer listings more informative. - (setq list-buffers-directory url) - ;; Let the URL library have a handle to the current URL for - ;; referer purposes. - (setq url-current-lastloc (url-generic-parse-url url))) - (unwind-protect - (progn - (cond - ((and eww-use-external-browser-for-content-type - (string-match-p eww-use-external-browser-for-content-type - (car content-type))) - (erase-buffer) - (insert "Unsupported content type") - (insert (format "

Content-type %s is unsupported

" - (car content-type))) - (insert (format "Direct link to the document" - url)) - (goto-char (point-min)) - (eww-display-html charset url nil point buffer encode)) - ((eww-html-p (car content-type)) - (eww-display-html charset url nil point buffer encode)) - ((equal (car content-type) "application/pdf") - (eww-display-pdf)) - ((string-match-p "\\`image/" (car content-type)) - (eww-display-image buffer)) - (t - (eww-display-raw buffer (or encode charset 'utf-8)))) - (with-current-buffer buffer - (plist-put eww-data :url url) - (eww--after-page-change) - (setq eww-history-position 0) - (and last-coding-system-used - (set-buffer-file-coding-system last-coding-system-used)) - (run-hooks 'eww-after-render-hook) - ;; Enable undo again so that undo works in text input - ;; boxes. - (setq buffer-undo-list nil))) - (kill-buffer data-buffer)))) + (when (buffer-live-p buffer) + (with-current-buffer buffer + ;; Save the https peer status. + (plist-put eww-data :peer (plist-get status :peer)) + ;; Make buffer listings more informative. + (setq list-buffers-directory url) + ;; Let the URL library have a handle to the current URL for + ;; referer purposes. + (setq url-current-lastloc (url-generic-parse-url url))) + (unwind-protect + (progn + (cond + ((and eww-use-external-browser-for-content-type + (string-match-p eww-use-external-browser-for-content-type + (car content-type))) + (erase-buffer) + (insert "Unsupported content type") + (insert (format "

Content-type %s is unsupported

" + (car content-type))) + (insert (format "Direct link to the document" + url)) + (goto-char (point-min)) + (eww-display-html charset url nil point buffer encode)) + ((eww-html-p (car content-type)) + (eww-display-html charset url nil point buffer encode)) + ((equal (car content-type) "application/pdf") + (eww-display-pdf)) + ((string-match-p "\\`image/" (car content-type)) + (eww-display-image buffer)) + (t + (eww-display-raw buffer (or encode charset 'utf-8)))) + (with-current-buffer buffer + (plist-put eww-data :url url) + (eww--after-page-change) + (setq eww-history-position 0) + (and last-coding-system-used + (set-buffer-file-coding-system last-coding-system-used)) + (run-hooks 'eww-after-render-hook) + ;; Enable undo again so that undo works in text input + ;; boxes. + (setq buffer-undo-list nil))) + (kill-buffer data-buffer))))) (defun eww-parse-headers () (let ((headers nil))