From: Lars Ingebrigtsen Date: Tue, 3 May 2022 17:20:52 +0000 (+0200) Subject: Fix thinko in recent tool bar caching logic X-Git-Tag: emacs-29.0.90~1931^2~95 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8ef34a065a10330777b172a7e5608f7939e7af29;p=emacs.git Fix thinko in recent tool bar caching logic * lisp/tool-bar.el (tool-bar--cache-key): New function. (tool-bar--flush-cache, tool-bar-make-keymap): Use it. --- diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el index 490fd0d3325..b3915c267cc 100644 --- a/lisp/tool-bar.el +++ b/lisp/tool-bar.el @@ -89,17 +89,20 @@ functions.") (declare-function image-mask-p "image.c" (spec &optional frame)) -(defconst tool-bar-keymap-cache (make-hash-table)) +(defconst tool-bar-keymap-cache (make-hash-table :test #'equal)) + +(defun tool-bar--cache-key () + (cons (frame-terminal) (sxhash-eq tool-bar-map))) (defun tool-bar--flush-cache () - (setf (gethash (frame-terminal) tool-bar-keymap-cache) nil)) + (setf (gethash (tool-bar--cache-key) tool-bar-keymap-cache) nil)) (defun tool-bar-make-keymap (&optional _ignore) "Generate an actual keymap from `tool-bar-map'. Its main job is to figure out which images to use based on the display's color capability and based on the available image libraries." - (or (gethash (frame-terminal) tool-bar-keymap-cache) - (setf (gethash (frame-terminal) tool-bar-keymap-cache) + (or (gethash (tool-bar--cache-key) tool-bar-keymap-cache) + (setf (gethash (tool-bar--cache-key) tool-bar-keymap-cache) (tool-bar-make-keymap-1)))) (defun tool-bar-make-keymap-1 ()