From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 23 04:43:49 2023 Received: (at submit) by debbugs.gnu.org; 23 Mar 2023 08:43:49 +0000 Received: from localhost ([127.0.0.1]:37311 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfGY0-0005Xf-Uf for submit@debbugs.gnu.org; Thu, 23 Mar 2023 04:43:49 -0400 Received: from lists.gnu.org ([209.51.188.17]:40372) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfGXy-0005XX-UR for submit@debbugs.gnu.org; Thu, 23 Mar 2023 04:43:47 -0400 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 1pfGXy-0001Wf-Of for bug-gnu-emacs@gnu.org; Thu, 23 Mar 2023 04:43:46 -0400 Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfGXw-0002Sg-O6 for bug-gnu-emacs@gnu.org; Thu, 23 Mar 2023 04:43:46 -0400 From: Eshel Yaron DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1679561023; bh=sTj7MHlxfVBsLouwp1l8VtO5H6V6qvt5d6WEiFGgKQk=; h=From:To:Subject:Date:From; b=fqii5C8uI68KAJIm39cfoPX7Drqx5bMzKxIVt2eDfQfggogNwxArUwdPLY3nSROHP oDGZQEOI8D2c8cE4dDlNFwPz/xAUqHzXe2R/+Oy7yM+MOB3L487c0teBhhw4T0Xadc 5RD2JGgwhd0/HwoUMTu66N1yxRIXFIc5sfEWmmlbYoCdR3hS7qMpPL39qcpj5CLgWb WGWhjHeltNUEN/5hIKL9jfPw/ni81MvQYFhvKxjvLu1ezQ2sVhAa+Pf25nxwFFlLUK Gvinnjy/prrYaW0HCqsmRK7bMcVvzyKaFDxJP2yB7ixN8GMiz4phqF0+18GATdVqUp dCkv7X8sGLelQ== To: bug-gnu-emacs@gnu.org Subject: 30.0.50; Emacs crashes on popup menu selection Date: Thu, 23 Mar 2023 10:43:39 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@eshelyaron.com; helo=eshelyaron.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Hi, For some time now Emacs crashes whenever I try to select from a popup menu in EWW. This happens deterministically, and Emacs always crashes in the same way in a call to `x-popup-menu` from `eww-change-select`. Trying to isolate the issue, I came up with the following minimal example: 1. emacs -Q 2. evaluate the following form to create a popup menu: (x-popup-menu `((0 0) ,(get-buffer-window)) '(keymap (Bar menu-item "Bar" ignore :key-sequence nil) (Baz menu-item "Baz" ignore :key-sequence nil))) 3. select an option from the menu 4. Emacs crashes with the following backtrace: Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGABRT) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000003 Exception Codes: 0x0000000000000001, 0x0000000000000003 VM Region Info: 0x3 is not in any region. Bytes before following region: 140737486401533 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL UNUSED SPACE AT START ---> shared memory 7fffffe23000-7fffffe24000 [ 4K] r-x/r-x SM=SHM Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x7ff8050b422a __pthread_kill + 10 1 libsystem_pthread.dylib 0x7ff8050ebf7b pthread_kill + 263 2 libsystem_c.dylib 0x7ff804ff8480 raise + 26 3 Emacs 0x10908b5f7 terminate_due_to_signal + 167 (emacs.c:464) 4 Emacs 0x10908bf8b emacs_abort + 15 (sysdep.c:2313) 5 Emacs 0x1090498a2 ns_term_shutdown + 162 (nsterm.m:5765) 6 Emacs 0x108ef32c8 shut_down_emacs + 344 (emacs.c:3017) 7 Emacs 0x10908b5c5 terminate_due_to_signal + 117 (emacs.c:447) 8 Emacs 0x108f1af9e handle_fatal_signal + 14 (sysdep.c:1783) 9 Emacs 0x108f1b021 deliver_thread_signal + 129 (sysdep.c:1775) 10 Emacs 0x108f19359 deliver_fatal_thread_signal + 9 (sysdep.c:1795) 11 Emacs 0x108f1b069 handle_sigsegv + 57 (sysdep.c:1888) 12 libsystem_platform.dylib 0x7ff805116c1d _sigtramp + 29 13 ??? 0x0 ??? 14 Emacs 0x10906c2be -[EmacsMenu runMenuAt:forFrame:keymaps:] + 318 (nsmenu.m:767) 15 Emacs 0x10906cb1b ns_menu_show + 1883 (nsmenu.m:1067) 16 Emacs 0x108e78c45 x_popup_menu_1 + 2325 (menu.c:1410) 17 Emacs 0x108f8e8af eval_sub + 2575 (eval.c:2503) 18 Emacs 0x108f8eadd Fprogn + 45 (eval.c:436) 19 Emacs 0x108f8e670 eval_sub + 2000 (eval.c:2451) 20 Emacs 0x108f933cd Feval + 77 (eval.c:2363) 21 elisp-mode-90dbfe40-cf3545f3.eln 0x10d39efef F656c6973702d2d6576616c2d6c6173742d73657870_elisp__eval_last_sexp_0 + 351 As a less contrived example, Emacs crashes (with a similar backtrace) when browsing https://search.marginalia.nu with EWW and trying to change one of the selections such as "Popular Sites" to another choice, e.g. "Academia". Thanks, Eshel In GNU Emacs 30.0.50 (build 25, x86_64-apple-darwin22.3.0, NS appkit-2299.40 Version 13.2.1 (Build 22D68)) of 2023-03-21 built on esmac.local Repository revision: 42fba8f36b19536964d6deb6a34f3fd1c02b43dd Repository branch: master Windowing system distributor 'Apple', version 10.3.2299 System Description: macOS 13.2.1 Configured using: 'configure --with-native-compilation --with-json --with-tree-sitter' Configured features: ACL DBUS GIF GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM ZLIB Important settings: value of $LC_CTYPE: UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra help-mode bytecomp byte-compile cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind kqueue cocoa ns lcms2 multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 77657 8466) (symbols 48 7093 0) (strings 32 18959 1997) (string-bytes 1 581298) (vectors 16 16146) (vector-slots 8 286623 12027) (floats 8 27 52) (intervals 56 219 0) (buffers 984 11)) From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 23 05:00:13 2023 Received: (at submit) by debbugs.gnu.org; 23 Mar 2023 09:00:13 +0000 Received: from localhost ([127.0.0.1]:37331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfGnt-00063B-5Y for submit@debbugs.gnu.org; Thu, 23 Mar 2023 05:00:13 -0400 Received: from lists.gnu.org ([209.51.188.17]:53868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfGnr-000630-Id for submit@debbugs.gnu.org; Thu, 23 Mar 2023 05:00:11 -0400 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 1pfGnq-0004yl-2R for bug-gnu-emacs@gnu.org; Thu, 23 Mar 2023 05:00:10 -0400 Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfGno-0005sm-1j for bug-gnu-emacs@gnu.org; Thu, 23 Mar 2023 05:00:09 -0400 Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id bf0265df (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 23 Mar 2023 08:59:58 +0000 (UTC) References: User-agent: mu4e 1.8.14; emacs 30.0.50 From: Ruijie Yu To: Eshel Yaron Subject: Re: bug#62402: 30.0.50; Emacs crashes on popup menu selection Date: Thu, 23 Mar 2023 16:56:20 +0800 In-reply-to: Message-ID: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: 62402@debbugs.gnu.org, bug-gnu-emacs@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > [...] > Trying to isolate the issue, I came up with the following minimal > example: > > 1. emacs -Q > 2. evaluate the following form to create a popup menu: > (x-popup-menu `((0 0) ,(get-buffer-window)) > '(keymap (Bar menu-item "Bar" ignore :key-sequence nil) > (Baz menu-item "Baz" ignore :key-sequence nil))) > 3. select an option from the menu > 4. Emacs crashes with the following backtrace: > > [...] > > Thanks, > Eshel > > In GNU Emacs 30.0.50 (build 25, x86_64-apple-darwin22.3.0, NS > appkit-2299.40 Version 13.2.1 (Build 22D68)) of 2023-03-21 built on > esmac.local > Repository revision: 42fba8f36b19536964d6deb6a34f3fd1c02b43dd > Repository branch: master > Windowing system distributor 'Apple', version 10.3.2299 > System Description: macOS 13.2.1 > > Configured using: > 'configure --with-native-compilation --with-json --with-tree-sitter' > > Configured features: > ACL DBUS GIF GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP > NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF > TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM ZLIB > FTR, I cannot reproduce this issue on PGTK GNU/Linux with 30.0.50 (c6bfffa9fe1af7f4f806e5533ba5f3c33476cf9a), so this issue might be OS- or WM-specific. -- Best, RY From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 23 05:36:32 2023 Received: (at 62402) by debbugs.gnu.org; 23 Mar 2023 09:36:32 +0000 Received: from localhost ([127.0.0.1]:37383 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfHN1-0006zh-RL for submit@debbugs.gnu.org; Thu, 23 Mar 2023 05:36:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44364) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfHMx-0006zJ-UV for 62402@debbugs.gnu.org; Thu, 23 Mar 2023 05:36:28 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfHMs-00084Q-C1; Thu, 23 Mar 2023 05:36:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Gd0FYLLyTlxX+8SknUwoY7ruftFXxtenmxTZL9Na+es=; b=f7KdQ4iOF/vq ZgTSJBKi2Moeia9ZwyZ1haj6ZWnpf7sbIcq6+gMiyn8KfI4cRF1dm41D3Tz3GMUVPLlOP6QjJ/Ev2 gS/g22CYg+inDqADxFCYN0P+IsEFPcGVToyTrXQhk9S7USq/K/NKs4AyMR2iawHm4iUXdIzwxXB+O oAplMN/8yQArWLSKQIs3YTBAFu9oVOLjxiTDhT5QqqnOzlhMUna4Ma03J6JinmJ1sEDTONRhFk7ru baORe+5B+M4gQhs1hdMp0C2Yq2DdmKi8W5iPoaDyPNO6SEJOz5qJjtzPLBwt0oWgtJu4idB40AFZJ 0pGcKdAIJFtRu1EUY5SxvA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfHMr-000299-HG; Thu, 23 Mar 2023 05:36:21 -0400 Date: Thu, 23 Mar 2023 11:36:38 +0200 Message-Id: <83zg834xnd.fsf@gnu.org> From: Eli Zaretskii To: Ruijie Yu In-Reply-To: (bug-gnu-emacs@gnu.org) Subject: Re: bug#62402: 30.0.50; Emacs crashes on popup menu selection References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62402 Cc: 62402@debbugs.gnu.org, me@eshelyaron.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 62402@debbugs.gnu.org > Date: Thu, 23 Mar 2023 16:56:20 +0800 > From: Ruijie Yu via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > FTR, I cannot reproduce this issue on PGTK GNU/Linux with 30.0.50 > (c6bfffa9fe1af7f4f806e5533ba5f3c33476cf9a), so this issue might be OS- > or WM-specific. And I cannot reproduce on MS-Windows, so I think this is indeed macOS specific. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 23 09:18:46 2023 Received: (at 62402) by debbugs.gnu.org; 23 Mar 2023 13:18:46 +0000 Received: from localhost ([127.0.0.1]:37507 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfKq6-00071m-Bq for submit@debbugs.gnu.org; Thu, 23 Mar 2023 09:18:46 -0400 Received: from mail.eshelyaron.com ([107.175.124.16]:56992 helo=eshelyaron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfKq4-00071e-Kx for 62402@debbugs.gnu.org; Thu, 23 Mar 2023 09:18:45 -0400 From: Eshel Yaron DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1679577524; bh=VdUVf9ThBAKtnfY0EVpiXgjUOev3XbD0jdUJGiRX0QU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Ge6mgOmyTw6/4UwodN65yt4QXAfW4G1LYcAqbQno034mZDy+EjK4olxMfVDgWrBqV f5JNyvx9QKmtdIGLB/GDnVdXIpLhYjXBFOancLcPalb8f4j8jncl+7LeEev8tPgcx/ XlYO4QNWYRsay5IwmQyGMmruWPL10ROrxhw/jXucZAwn+3CdJovQXcRUmfWZARd8Ad ww+XNSdI7supeQi26csV9dGi46bG3hp3f4TX0SbuO9W3anVCAh6/aRq2/V7BrW6bnq S+VakEhZtK+zUayRe66wMbZy9S6Ft+TJwC7/7NSut0yst6m31XMLymCmkscC1QXW/J Jpf9NzK+r2UjQ== To: Eli Zaretskii Subject: Re: bug#62402: 30.0.50; Emacs crashes on popup menu selection In-Reply-To: <83zg834xnd.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 23 Mar 2023 11:36:38 +0200") References: <83zg834xnd.fsf@gnu.org> Date: Thu, 23 Mar 2023 15:18:41 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 62402 Cc: Ruijie Yu , 62402@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> Cc: 62402@debbugs.gnu.org >> Date: Thu, 23 Mar 2023 16:56:20 +0800 >> From: Ruijie Yu via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >> >> FTR, I cannot reproduce this issue on PGTK GNU/Linux with 30.0.50 >> (c6bfffa9fe1af7f4f806e5533ba5f3c33476cf9a), so this issue might be OS- >> or WM-specific. > > And I cannot reproduce on MS-Windows, so I think this is indeed macOS > specific. Thanks for looking into it. Indeed it seems to be a problem specific to MacOS. To shed some more light I've rebuilt Emacs with CFLAGS="-g3 -O0" and ran it under lldb, which shows the following backtrace: * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x3) * frame #0: 0x00000001000aebad emacs`AREF(array=0x0000000000000000, idx=0) at lisp.h:1947:10 frame #1: 0x00000001000af660 emacs`find_and_return_menu_selection(f=0x00000001100dee30, keymaps=true, client_data=0x000000011089b888) at menu.c:985:11 frame #2: 0x0000000100380f2b emacs`-[EmacsMenu runMenuAt:forFrame:keymaps:](self=0x00006000017007c0, _cmd="runMenuAt:forFrame:keymaps:", p=(x = 2, y = 506), f=0x00000001100dee30, keymaps=true) at nsmenu.m:767:9 frame #3: 0x0000000100381f00 emacs`ns_menu_show(f=0x00000001100dee30, x=2, y=2, menuflags=1, title=0x0000000000000000, error=0x00007ff7bfefce80) at nsmenu.m:1067:9 frame #4: 0x00000001000b1203 emacs`x_popup_menu_1(position=0x000000011804dcb3, menu=0x000000011804e003) at menu.c:1410:17 frame #5: 0x00000001000b15a2 emacs`Fx_popup_menu(position=0x000000011804dcb3, menu=0x000000011804e003) at menu.c:1474:10 frame #6: 0x0000000100247c58 emacs`eval_sub(form=0x000000011804dd23) at eval.c:2503:15 ... It seems that the (MacOS-specific) function `find_and_return_menu_selection` in menu.c tries to access the global variable `menu_items` before it's initialized. I'm not sure when or where it should be initialized though :( -- Eshel