all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#65678: 30.0.50; EWW rendered errs when the EWW buffer is closed before the page gets loaded
@ 2023-09-01 13:44 Ihor Radchenko
  2023-09-02  8:00 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2023-09-01 13:44 UTC (permalink / raw)
  To: 65678

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 #<killed buffer> nil)
  (url-http-activate-callback)
  (url-http-chunked-encoding-after-change-function 12257 12929 672)
  (url-http-generic-filter #<process sfba.social> "\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.

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.17.8) of 2023-08-29 built on localhost
Repository revision: 5e254a0f46e2410763d1b58135442ed0d50b0fed
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
System Description: Gentoo Linux

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#65678: 30.0.50; EWW rendered errs when the EWW buffer is closed before the page gets loaded
  2023-09-01 13:44 bug#65678: 30.0.50; EWW rendered errs when the EWW buffer is closed before the page gets loaded Ihor Radchenko
@ 2023-09-02  8:00 ` Eli Zaretskii
  2023-09-02 11:38   ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2023-09-02  8:00 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 65678

> From: Ihor Radchenko <yantar92@posteo.net>
> 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 #<killed buffer> nil)
>   (url-http-activate-callback)
>   (url-http-chunked-encoding-after-change-function 12257 12929 672)
>   (url-http-generic-filter #<process sfba.social> "\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 "<title>Unsupported content type</title>")
-            (insert (format "<h1>Content-type %s is unsupported</h1>"
-                            (car content-type)))
-            (insert (format "<a href=%S>Direct link to the document</a>"
-                            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 "<title>Unsupported content type</title>")
+              (insert (format "<h1>Content-type %s is unsupported</h1>"
+                              (car content-type)))
+              (insert (format "<a href=%S>Direct link to the document</a>"
+                              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))





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#65678: 30.0.50; EWW rendered errs when the EWW buffer is closed before the page gets loaded
  2023-09-02  8:00 ` Eli Zaretskii
@ 2023-09-02 11:38   ` Eli Zaretskii
  2023-09-08  8:48     ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2023-09-02 11:38 UTC (permalink / raw)
  To: yantar92; +Cc: 65678

> Cc: 65678@debbugs.gnu.org
> Date: Sat, 02 Sep 2023 11:00:10 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> 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?

Sorry, that patch included a thinko.  Please try the below one
instead:

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 089e481..4ddda21 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -620,46 +620,49 @@ 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 "<title>Unsupported content type</title>")
-            (insert (format "<h1>Content-type %s is unsupported</h1>"
-                            (car content-type)))
-            (insert (format "<a href=%S>Direct link to the document</a>"
-                            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)))
+    (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 "<title>Unsupported content type</title>")
+              (insert (format "<h1>Content-type %s is unsupported</h1>"
+                              (car content-type)))
+              (insert (format "<a href=%S>Direct link to the document</a>"
+                              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)))
+    (unless (buffer-live-p buffer)
       (kill-buffer data-buffer))))
 
 (defun eww-parse-headers ()





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#65678: 30.0.50; EWW rendered errs when the EWW buffer is closed before the page gets loaded
  2023-09-02 11:38   ` Eli Zaretskii
@ 2023-09-08  8:48     ` Ihor Radchenko
  2023-09-08 12:12       ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2023-09-08  8:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 65678

Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: 65678@debbugs.gnu.org
>> Date: Sat, 02 Sep 2023 11:00:10 +0300
>> From: Eli Zaretskii <eliz@gnu.org>
>> 
>> 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?
>
> Sorry, that patch included a thinko.  Please try the below one
> instead:

After applying this patch, I am no longer seeing the errors.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#65678: 30.0.50; EWW rendered errs when the EWW buffer is closed before the page gets loaded
  2023-09-08  8:48     ` Ihor Radchenko
@ 2023-09-08 12:12       ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2023-09-08 12:12 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 65678-done

> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: 65678@debbugs.gnu.org
> Date: Fri, 08 Sep 2023 08:48:06 +0000
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> Cc: 65678@debbugs.gnu.org
> >> Date: Sat, 02 Sep 2023 11:00:10 +0300
> >> From: Eli Zaretskii <eliz@gnu.org>
> >> 
> >> 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?
> >
> > Sorry, that patch included a thinko.  Please try the below one
> > instead:
> 
> After applying this patch, I am no longer seeing the errors.

Thanks, installed on master, and closing the bug.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-08 12:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-01 13:44 bug#65678: 30.0.50; EWW rendered errs when the EWW buffer is closed before the page gets loaded Ihor Radchenko
2023-09-02  8:00 ` Eli Zaretskii
2023-09-02 11:38   ` Eli Zaretskii
2023-09-08  8:48     ` Ihor Radchenko
2023-09-08 12:12       ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.