1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00

Cancel xwidget progress timer when buffer is killed

* lisp/xwidget.el (xwidget-webkit-buffer-kill): New function.
(xwidget-webkit-mode): Add `xwidget-webkit-buffer-kill' to
`kill-buffer-hook'.  (bug#52344)
This commit is contained in:
Po Lu 2021-12-07 13:44:52 +08:00
parent e17aea73a5
commit bdcf3c3504

View File

@ -409,6 +409,11 @@ If N is omitted or nil, scroll backwards by one char."
(with-current-buffer (xwidget-buffer xwidget)
(force-mode-line-update)))
(defun xwidget-webkit-buffer-kill ()
"Clean up an xwidget-webkit buffer before it is killed."
(when (timerp xwidget-webkit--progress-update-timer)
(cancel-timer xwidget-webkit--progress-update-timer)))
(defun xwidget-webkit-callback (xwidget xwidget-event-type)
"Callback for xwidgets.
XWIDGET instance, XWIDGET-EVENT-TYPE depends on the originating xwidget."
@ -479,6 +484,7 @@ If non-nil, plugins are enabled. Otherwise, disabled."
(define-derived-mode xwidget-webkit-mode special-mode "xwidget-webkit"
"Xwidget webkit view mode."
(setq buffer-read-only t)
(add-hook 'kill-buffer-hook #'xwidget-webkit-buffer-kill)
(setq-local tool-bar-map xwidget-webkit-tool-bar-map)
(setq-local bookmark-make-record-function
#'xwidget-webkit-bookmark-make-record)