From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#63495: 28.2; menu crashes on macos Date: Mon, 10 Jul 2023 23:33:52 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25703"; mail-complaints-to="usenet@ciao.gmane.io" Cc: obriendavid1@gmail.com, me@eshelyaron.com, 63495@debbugs.gnu.org To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 11 00:35:24 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 1qIzTY-0006Tx-1d for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 11 Jul 2023 00:35:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIzTD-0005R3-D1; Mon, 10 Jul 2023 18:35:03 -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 1qIzTC-0005Qd-0t for bug-gnu-emacs@gnu.org; Mon, 10 Jul 2023 18:35:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIzTB-0004QQ-P1 for bug-gnu-emacs@gnu.org; Mon, 10 Jul 2023 18:35:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qIzTB-0000TJ-LJ for bug-gnu-emacs@gnu.org; Mon, 10 Jul 2023 18:35:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 Jul 2023 22:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63495 X-GNU-PR-Package: emacs Original-Received: via spool by 63495-submit@debbugs.gnu.org id=B63495.16890284431741 (code B ref 63495); Mon, 10 Jul 2023 22:35:01 +0000 Original-Received: (at 63495) by debbugs.gnu.org; 10 Jul 2023 22:34:03 +0000 Original-Received: from localhost ([127.0.0.1]:49345 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qIzSF-0000S1-9H for submit@debbugs.gnu.org; Mon, 10 Jul 2023 18:34:03 -0400 Original-Received: from dane.soverin.net ([185.233.34.148]:46241) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qIzSC-0000RC-Ub for 63495@debbugs.gnu.org; Mon, 10 Jul 2023 18:34:01 -0400 Original-Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dane.soverin.net (Postfix) with ESMTPS id 4R0Jh22Qzkz2xN7; Mon, 10 Jul 2023 22:33:54 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.100]) by soverin.net (Postfix) with ESMTPSA id 4R0Jh16P9DzHS; Mon, 10 Jul 2023 22:33:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1689028434; bh=RQFoLJfbOhNwKylMn1gf3lQ1x6yUQS4pKkWf60iHKcU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V66ylZA8fmn/aCJoWqDWvNBbK5Q7RtDh/MTA5ASGb3IzZS3YMpGQGYPJEK84nkAO2 mrUGg/sEdWEvIlog1uhYVP7S1MgiJxlgqWtgiuORsf5R4grhKFR0xhx+MAU4bQX/lf XbUIUD4DMzd3yd5nhhj5zvnpXFiTYvItaadt751rD1mbUXzA0bXI3+VTl0vCjdi45T Wgzgivpr0OFN4qbrxLq0B3AYLB57yUJq5Dm1FQ7sQ1mWPiHTsBI1kcd6ObajnRFmOj Icjry2uVUKdUE58nVaENw8MZti82BjgOGyOZPBdIRJI2+nU1l7XjlJx9mLQVa309dZ fvoyMtzCQboTw== Original-Received: from alan by faroe.holly.idiocy.org with local (Exim 4.96) (envelope-from ) id 1qIzS5-00039r-0a; Mon, 10 Jul 2023 23:33:53 +0100 X-Soverin-Authenticated: true Mail-Followup-To: Alan Third , Daniel =?UTF-8?Q?Mart=C3=ADn?= , 63495@debbugs.gnu.org, obriendavid1@gmail.com, me@eshelyaron.com Content-Disposition: inline In-Reply-To: X-CMAE-Score: 0 X-CMAE-Analysis: v=2.4 cv=Mfmq+bzf c=1 sm=1 tr=0 ts=64ac8752 a=8nJEP1OIZ-IA:10 a=ws7JD89P4LkA:10 a=mDV3o1hIAAAA:8 a=hIj89exaAAAA:8 a=1pH-sUdhdR2AHcEy1ocA:9 a=wPNLvfGTeEIA:10 a=_FVE-zBwftR9WsbkzFJk:22 a=lS9wXHQM5UdnNJ4u63Ry:22 X-Cloudmark-Reporter: XwCdxO2Qeu+pd3DeZ7wndH9OM0E= 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:264908 Archived-At: On Mon, Jul 10, 2023 at 11:00:49PM +0200, Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text > editors" writes: > > >>> When using the menu - I can call up and see the menu, but if I try to > >>> select a menu item this always results in emacs crashing. > >> > >> I can't reproduce this bug on Emacs 29. Could you try to reproduce it > >> on this version? I remember fixing some problems with the macOS menu > >> bar recently, so perhaps this bug is already fixed. > > > > FWIW this seems very similar to Bug#62402. At least over here (macOS > > 13.4, Emacs master), Emacs still reliably crashes when selecting an item > > in a popup menu. > > Thanks, I can reproduce the issue with the recipe in Bug#62402. I see > that this is a regression in Emacs 28 and Emacs 29. I can't reproduce > the bug in Emacs 27. > > A bisect shows that this is the first commit that introduced the bug: > > commit c9b37634b131f3617314bd5a38090e96d0b465cf > Author: Alan Third > Date: Wed Dec 23 20:12:02 2020 +0000 > > Remove NS menu synthesized events (bug#44333) > > Remove the frame tracking stuff as it's not used for anything, and > move the update tracking into the EmacsMenu class. > > * src/nsmenu.m (ns_update_menubar): Copy the parsing code from xmenu.c > and rework the NS specific code around to update the existing menus > instead of rebuilding them completely. > (ns_activate_menubar): > ([EmacsMenu trackingNotification:]): > ([EmacsMenu menuWillOpen:]): > ([EmacsMenu menuDidClose:]): Remove unused functions. > ([EmacsMenu menuNeedsUpdate:]): Remove menu tracking code and add code > to check whether an update is required. > ([EmacsMenu fillWithWidgetValue:]): > ([EmacsMenu addSubmenuWithTitle:]): > ([EmacsMenu initWithTitle:]): Remove references to frame. > ([EmacsMenu setFrame:]): Remove method. > ([EmacsMenu clear]): Rename to removeAllItems. > ([EmacsMenu removeAllItems]): Use built-in removeAllItems, if > available. > (syms_of_nsmenu): Remove tracking code. > * src/nsterm.m (ns_check_menu_open): > (ns_check_pending_open_menu): > (ns_create_terminal): Remove unused functions. > (ns_term_init): Get rid of menu tracking. > * src/nsterm.h (EmacsMenu): Remove frame, add needsUpdate and update > method definitions. > > One notable thing in that patch is that, in menuNeedsUpdate:, > ns_update_menubar is now called, if needed, in the Cocoa and the GNUstep > build. If I put the call to ns_update_menubar inside the #ifdef > NS_IMPL_GNUSTEP (so that it's not run in the Cocoa build), I can't > reproduce the crash anymore. But I don't know if there are any side > effects or what motivated the change in the first place. I can't remember exactly why it was done as it was, but I do remember there were big problems with getting the menus to update in a timely manner. It's interesting that the crash is happening in runMenuAt:forFrame:keymaps: with it trying to access memory at address 0x3. There's nothing obvious in that function that would be doing that, so it would be good if we could get a backtrace from a debugger showing the exact line that's causing the problem and, if possible, which variable has the value 3. -- Alan Third