From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#43397: 28.0.50; Adding tool bar items: update tool bar Date: Tue, 03 May 2022 12:31:08 -0400 Message-ID: References: <87h7s0jurl.fsf@gmail.com> <83lfhb83hm.fsf@gnu.org> <874kban5vm.fsf@gnus.org> <87tuj9io2e.fsf@gnus.org> <87sfpqws8m.fsf@gnus.org> <87y1zivbr9.fsf@gnus.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31846"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 43397@debbugs.gnu.org, Eli Zaretskii , Caio Henrique To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 03 18:45:02 2022 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 1nlve2-00086E-HA for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 03 May 2022 18:45:02 +0200 Original-Received: from localhost ([::1]:46068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlve1-0005pX-IY for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 03 May 2022 12:45:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlvRS-0003pF-Ss for bug-gnu-emacs@gnu.org; Tue, 03 May 2022 12:32:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46934) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlvRS-0000iA-K4 for bug-gnu-emacs@gnu.org; Tue, 03 May 2022 12:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlvRS-00058B-GL for bug-gnu-emacs@gnu.org; Tue, 03 May 2022 12:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 May 2022 16:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43397 X-GNU-PR-Package: emacs Original-Received: via spool by 43397-submit@debbugs.gnu.org id=B43397.165159547717288 (code B ref 43397); Tue, 03 May 2022 16:32:02 +0000 Original-Received: (at 43397) by debbugs.gnu.org; 3 May 2022 16:31:17 +0000 Original-Received: from localhost ([127.0.0.1]:40831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlvQj-0004UW-Hx for submit@debbugs.gnu.org; Tue, 03 May 2022 12:31:17 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:17590) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlvQi-0004Nx-Ir for 43397@debbugs.gnu.org; Tue, 03 May 2022 12:31:16 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id E8434442678; Tue, 3 May 2022 12:31:10 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 7E2BC442675; Tue, 3 May 2022 12:31:09 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1651595469; bh=stnSLbOzTvoV7TtEIccA00OxPv5hdL86Zy0U3uVspMI=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=GGfArgndulbwwnQ9Qak1lLJc/iq2OjMljsx4Y3bPCfmyRfUgvq0nSZaLgaTI2YYeR vEnS1LVOvtu/oDBJPjpxXn+lHISZM53aO9Dc4qqgZuXDvy4KiJmgGtvrKWwOHdgxTh /kb2ZABjODJqGvO1JUwug6aWaBiN233KukekHjkSHHiBe8dBz3WUMN9J9WzONE9asv ulxYJGs/vMQ2LWRP4K5jObnliFQ3Z5EjzoI+EoGE7XCU9IfxWhYb10AvvORYiYwAsP c/j8c4LfabqavgLPHDYW5JtIAkFWIu5L8x3BKp7EtGRoMkGZDahw02zmMvBqFbFBGE 4ddIAB7t8R9tg== Original-Received: from alfajor (unknown [45.72.221.51]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4A8FE1206CF; Tue, 3 May 2022 12:31:09 -0400 (EDT) In-Reply-To: <87y1zivbr9.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 03 May 2022 18:09:30 +0200") 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" Xref: news.gmane.io gmane.emacs.bugs:231338 Archived-At: > Hm... poking around in that code, I don't quite follow how this is all > supposed to be hooked up, or which caches should be flushed. Does the > crystal ball have more insights? This cache is broken: (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." (let ((key (cons (frame-terminal) tool-bar-map))) (or (gethash key tool-bar-keymap-cache) (puthash key (tool-bar-make-keymap-1) tool-bar-keymap-cache)))) `tool-bar-map` is a normal keymap, which we modify in the usual way, i.e. via side-effect. So the key we place in this `equal` hash table will be routinely modified via side-effect, thus changing its sxhash. Maybe we'd be better off using an `eq` hash table and manually flushing the corresponding entry whenever `tool-bar-map` is modified by side-effect. I also see that we use a `:weakness t` but the values stored there will usually not be stored anywhere else, so the hash table will be completely flushed at every GC (and partly refilled soon after as part of redisplay). It should have `:weakness 'key` instead (but without fixing the current bug report, this will cause the keymap to never be refreshed until we manually flush the hash table ;-). Stefan