GNU bug report logs - #81510
31.0.90; NS (macOS): clicking a disabled (:enable nil) tab-bar item crases Emacs

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Al Haji-Ali <abdo.haji.ali@HIDDEN>; dated Tue, 28 Jul 2026 15:31:04 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 81510 <at> debbugs.gnu.org:


Received: (at 81510) by debbugs.gnu.org; 30 Jul 2026 15:05:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 30 11:05:30 2026
Received: from localhost ([127.0.0.1]:32875 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wpSK9-00067Q-S7
	for submit <at> debbugs.gnu.org; Thu, 30 Jul 2026 11:05:30 -0400
Received: from mail-vs1-xe29.google.com ([2607:f8b0:4864:20::e29]:61603)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1wpSK7-000672-NL
 for 81510 <at> debbugs.gnu.org; Thu, 30 Jul 2026 11:05:28 -0400
Received: by mail-vs1-xe29.google.com with SMTP id
 ada2fe7eead31-738a5cc517eso1475394137.2
 for <81510 <at> debbugs.gnu.org>; Thu, 30 Jul 2026 08:05:27 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1785423922; cv=none;
 d=google.com; s=arc-20260327;
 b=rfRKT3TnZTFE2bmGKQ71ghVQ8lhNnig8Y65Oa1MUmM0uJUt2cwV5l0J+x89Ex1N/R8
 QyCDcZsBKmgZMf3y1YTanmBR4LgN7Kka9lD/yJC2TtPJFfM1Tk6V8+emMbDmgyp3RX1i
 etgepPrMKZ0ZdOfp4D3b1pKDZGU6jCbeNs+jGCxPHnn6UkxTqWuYCTLNbmAuQlcx0Cxx
 /RuDqmamR3929K6dqEHc2LN0f9fxBICJp6AokqM3Hz1F2bvUe2D6UyH4WWrdKB4a9sTA
 t0eBwbOQ3as+/FNdYM40C+KiI6hpVDwjkmQ6DKfL+lMfTkqvsveRamDaByr0i3qsJzIa
 GPJA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
 s=arc-20260327; 
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:dkim-signature;
 bh=d9q0HK5nqa33Mmym9i0s/TIRBWHyFdnWSFaSvh4WgJM=;
 fh=e0Me62LsjpY85auY+14jAQKQldXrxehK0eSWuTsBp1k=;
 b=jCxVFb/ytHLirlt2Q6u4y6cnpEsbXNLequeJqUbF9paGJjGU8AXQ8pGTn8Bew38IX/
 s90GaCjjKaRt+2yIfgjC/1FeKwYh1vSVf9kkOXtbnfaXWJ/KKvvtTosX1lhmC5S5KVf6
 Va95+CN8c67WckbP/V5XWxIqydnVOq+ZeHRN6Bo3jo/KvKjMZbOPNSr8w8K2NizvH3+t
 w1HmDI3Yem7tyZDbKIjQC5CV7MiUhzQRRI9hetihdu8CTCoT5xHYT89gQPspExFD2Dtf
 FUS3iHAi7jz/u4jKRzVKdVrQQB6lr4a3ff5yC2M9uL7wJ5XuxcxhEFcQJFEjpS4d8bFj
 rb+w==; darn=debbugs.gnu.org
ARC-Authentication-Results: i=1; mx.google.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1785423922; x=1786028722; darn=debbugs.gnu.org;
 h=content-type:cc:to:subject:message-id:date:from:in-reply-to
 :references:mime-version:from:to:cc:subject:date:message-id:reply-to
 :content-type; bh=d9q0HK5nqa33Mmym9i0s/TIRBWHyFdnWSFaSvh4WgJM=;
 b=pl3+nAFCSaj6Pyj/57+Ys8Lc6ZeXJDrmIkRm9qls74igKB9gOmb3QKwFe+niuQTQYa
 XuTED1qKJlhSZNfkiPtvzSJgXsGaCgoPBYY+lUqAIdKEhvpwQDErv1eYL5lb1dzZJqld
 /acKJYwDcRjouyStjR7MC8DQ0OY9iPYww6h1UE2091ZRCJexptZvVQmCPvy4HgpNsDHd
 61U/B+h673mqDMct5fZ6YtOGMJctMq1k4zwKMSRpA3Y7Pe3cyi3KVa465tgX2kg8tHIc
 Z1JLaarAQhwSPPnuV+6SDcbxRX+O2XEXiuK5gU06GmdjBt6HNahbclf6JJag8SzgGSpO
 yGHg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1785423922; x=1786028722;
 h=content-type:cc:to:subject:message-id:date:from:in-reply-to
 :references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to:content-type;
 bh=d9q0HK5nqa33Mmym9i0s/TIRBWHyFdnWSFaSvh4WgJM=;
 b=levfnVxrRGVuvnrqHNEkzZ2PxyMKMAjmEk8DCvN8lnZqrriDx42niJJpjUGJyJAAXx
 VfrVfeQGp7Wc3EMywfvEoAPwkkrUb5zannFrYYyKFBFwqiGl20TbJa1emkpMssOjkoD8
 773eRjUcWvziWEmObL2A+NSnaE2i9pKLfjLwWPpFp2ccYDp0TmatHHImuYoFvymsJL/X
 ml62q3se3Ek9gciR9QFS2z8O749oSvqmhBBIot1feDFPuLGJfJCNT6CSkMmHfEbJ2i7G
 mVbTUN1iKVlpugB808XWByJuLJKhdKqT7z2uJrHdbO8ambrZ0b7dUhSZbow6+OJY8tLE
 2MGw==
X-Forwarded-Encrypted: i=1;
 AHgh+RoFazQwk6TUWHlNm65kCCV7PAYy9/951I5E70J07HPe9y79MvK3b9vfgFTE5Lu7fEtYqcrs0w==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyXfFzszaljfh7P8dmsBK7jM/hPmODbXViuZf/mNXNi/+5g02PM
 cLfSCUU0pyC6C2Jkr7Z1hNQHWWmcXVrb6xHE8SejzCpadDRxM8oSWRbCD379VPiAY40AfbnRrhR
 D+jIyyWUM6BqSndral1y41U6ug4w3ov0=
X-Gm-Gg: AR+sD135GucUWK+76el1oHapivQ5O3Hp2h4i7FuYu/LJyr6TDB6tTKiYzzkEc1uuEwI
 sQCP4rseOdwurYCKxhssPldg8tUC7m6eWhpM+zld/K91nY05fmKA/hC+uiQhHyux6vpPxOHqcUt
 lu5PQIGwzS4O7MQRcXc4my1KCrnBl90KARsPuVVZbchzBvKUNUSLodHp+ABpLmmyOOc08zBRLlM
 0Jp5L6ghbNN7m5rRwH4Ykn6oqbi2NHKCPi1JcvFCqdPQatKHxQpcC+JQJnbbbUyw9ncHYDHeDiD
 yhG24FtXDJcAdJpPXYfjbCKYgRcqfp+OqTMeF7a4eQJRTwUiYWql6l0gH+D/p/UcjnpEzeSppMF
 QHR3SW5gceJGzH0k4t5fN1kWEVQUV3ubquGwcNTQr8J9rntk+htTVhv+/756N2ND1Ep8kmGoW7s
 6QSCPUgTt5uRBEv8eTjlkY2HXKnXpOAwPvfQmcQcQMIiVHZVbX7PxB21zj2xSzCy0sppI=
X-Received: by 2002:a05:6102:512a:b0:738:531e:a43e with SMTP id
 ada2fe7eead31-7574e1dbfd2mr1172625137.7.1785423921912; Thu, 30 Jul 2026
 08:05:21 -0700 (PDT)
MIME-Version: 1.0
References: <m1h5ljqgpe.fsf@HIDDEN> <86fr13ng3u.fsf@HIDDEN>
 <amj-iEQP6jaAgUqz@HIDDEN> <86a4rao7fa.fsf@HIDDEN>
 <CAN+1HbobEfagofi-Yv598xEJh-9e8CJptz5fG19GA2Z8ApSq3A@HIDDEN>
 <amo8xVY9zoGqvYWr@HIDDEN> <m21pcl76ji.fsf@HIDDEN>
In-Reply-To: <m21pcl76ji.fsf@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Thu, 30 Jul 2026 17:05:10 +0200
X-Gm-Features: AUfX_mynSEeevfg9BIB9sOcHG5zoCFECQ5-8xQTWxsmIk4nSb_ohum8Kb_WYkq8
Message-ID: <CAN+1HbonTGOf+9CfOX1BPga6qBKZ=LvAL=AvLiPPaf5Wc=3tqg@HIDDEN>
Subject: Re: bug#81510: 31.0.90; NS (macOS): clicking a disabled (:enable nil)
 tab-bar item crases Emacs
To: Al Haji-Ali <abdo.haji.ali@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000a3a0790657d56689"
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 81510
Cc: Alan Third <alan@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
 81510 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

--000000000000a3a0790657d56689
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Wed, Jul 29, 2026 at 6:55=E2=80=AFPM Al Haji-Ali <abdo.haji.ali@HIDDEN=
m> wrote:

>
> On 29/07/2026, Alan Third wrote:
> > Al Haji-Ali, are you able to check this fixes the problem for you too?
>
> I have the same crash with this patch, it seems (btw, the issue is not
> with an empty tab bar, but a disabled button), see the repro code I had
> in my report.
>
> I am not sure I fully understand the logic of the patch tbh.
>
> The previous issue is that kbd_buffer_store_buffered_event is ultimately
> called with: event->kind =3D=3D NO_EVENT
> which causes an emacs_abort();
>
> This is caused in the current code because event->kind is initialized as
> `NO_EVENT` and
>
> (!(tab_bar_p && NILP (tab_bar_arg)))
>
> is false (since in particular tab_bar_arg is NIL) and the value of kind
> remains NO_EVENT.
>
> In the patch the code:
>
> if (tab_bar_p && NILP (tab_bar_arg))
>     emacs_event->kind =3D NO_EVENT;
>
> has the exact same effect, since the condition is flipped and
> (tab_bar_p && NILP (tab_bar_arg))
> is now true, leaving kind be NO_EVENT.
>
> I see that w32term is doing the same thing, but I am not sure why it's
> not crashing for you.
>

I ran your test case with Alan's patch and it did not crash for me (or with
mine).

--000000000000a3a0790657d56689
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif;b=
ackground-color:transparent">On Wed, Jul 29, 2026 at 6:55=E2=80=AFPM Al Haj=
i-Ali &lt;<a href=3D"mailto:abdo.haji.ali@HIDDEN">abdo.haji.ali@HIDDEN=
m</a>&gt; wrote:</span></div></div><div class=3D"gmail_quote gmail_quote_co=
ntainer"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On 29/07/2026, Alan Third wrote:<br>
&gt; Al Haji-Ali, are you able to check this fixes the problem for you too?=
<br>
<br>
I have the same crash with this patch, it seems (btw, the issue is not<br>
with an empty tab bar, but a disabled button), see the repro code I had<br>
in my report.<br>
<br>
I am not sure I fully understand the logic of the patch tbh.<br>
<br>
The previous issue is that kbd_buffer_store_buffered_event is ultimately<br=
>
called with: event-&gt;kind =3D=3D NO_EVENT<br>
which causes an emacs_abort();<br>
<br>
This is caused in the current code because event-&gt;kind is initialized as=
<br>
`NO_EVENT` and<br>
<br>
(!(tab_bar_p &amp;&amp; NILP (tab_bar_arg)))<br>
<br>
is false (since in particular tab_bar_arg is NIL) and the value of kind<br>
remains NO_EVENT.<br>
<br>
In the patch the code:<br>
<br>
if (tab_bar_p &amp;&amp; NILP (tab_bar_arg))<br>
=C2=A0 =C2=A0 emacs_event-&gt;kind =3D NO_EVENT;<br>
<br>
has the exact same effect, since the condition is flipped and<br>
(tab_bar_p &amp;&amp; NILP (tab_bar_arg))<br>
is now true, leaving kind be NO_EVENT.<br>
<br>
I see that w32term is doing the same thing, but I am not sure why it&#39;s<=
br>
not crashing for you.<br></blockquote><div><br></div><div class=3D"gmail_de=
fault" style=3D"font-family:monospace">I ran your test case with Alan&#39;s=
 patch and it did not crash for me (or with mine).</div></div></div>

--000000000000a3a0790657d56689--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81510; Package emacs. Full text available.
Added indication that bug 81510 blocks81521 Request was from Sean Whitton <spwhitton@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 81510 <at> debbugs.gnu.org:


Received: (at 81510) by debbugs.gnu.org; 29 Jul 2026 22:55:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 29 18:55:18 2026
Received: from localhost ([127.0.0.1]:55511 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wpDBD-0006Pt-9N
	for submit <at> debbugs.gnu.org; Wed, 29 Jul 2026 18:55:18 -0400
Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:61644)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <abdo.haji.ali@HIDDEN>)
 id 1wpDB9-0006MZ-Jl
 for 81510 <at> debbugs.gnu.org; Wed, 29 Jul 2026 18:55:13 -0400
Received: by mail-wm1-x32a.google.com with SMTP id
 5b1f17b1804b1-4953e04ef16so14153575e9.2
 for <81510 <at> debbugs.gnu.org>; Wed, 29 Jul 2026 15:55:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1785365705; x=1785970505; darn=debbugs.gnu.org;
 h=content-type:mime-version:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to
 :content-type; bh=IERH7M3X+1G1k3Y4a9VOrmIDh61qEk/x59A4Gn+uiPE=;
 b=ZUsr1CoM6rUCdZLOU00Sgntw6hBA2VVeq8/xzrmPpmeNnV+ir5q4NDWmqLxNOWV7ty
 b4ZynovqtPCteWze4kMnZqQZ6EHIWph1FxJ8xPu+e6aVSr8vqYCQ+K9XYLc3IWZn/t6m
 YKclHDuzoy8zc4IUhbW3qQd/+/C2zo3n/385JHld5Ah7GKBKzR8BLGIgSeEj/HfB1AKg
 0fMvzukT5jnZZTwTJLWaP+QpwGDfX6NWTeYd2N0cDacXDslJXRULYzABh0orJjq1uDPt
 WwmErbxNwEupwZrbAQz10Mp9OqPU3WBbIUdajomCjX42ogpVSl/31XItfL3dWwWBtjmh
 u0Ng==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1785365705; x=1785970505;
 h=content-type:mime-version:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject
 :date:message-id:reply-to:content-type;
 bh=IERH7M3X+1G1k3Y4a9VOrmIDh61qEk/x59A4Gn+uiPE=;
 b=Ro5FPZhdc03TPD7kJ2eeXisyTxTKBJTHXkJhnzFnzxdRD7xjzReEsCcBq94e1Qv8+A
 oYmenrwnlKCcHI1uBXAi8kKOLSb+0LkD5UEhZF5W6hRtS9T5vhh+BFFVCKv0sVlXnL14
 j5h/IcCXw5TAWvkLHKa+Useq1Mu8flSchHM1dlhxS4Hmm46VksNtRslfa0ExApUd+Ac4
 O/ofXZVYGnIJ9Zu+lJazHXWFrLPU6GKvex0tCMrnvCVSLREE1vN2LyIDzE4gTXc18QZ0
 l6jqk/TU4MJByCOvSvJQkISrl/yQgIL8MRrd7goM4O1hQi4hdFqsCHJ671CRY03SNqBr
 VJsw==
X-Forwarded-Encrypted: i=1;
 AHgh+Rqr1+Dm4L+HhHtsFp07N3MKlzOcN1X0pULF3wIFjSLBwJGQqIZq+rtaznOntGpWA5iTaTtXjw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzF5uEwis+FBLEtwMQx3nJfBIDafXVP9q1SFdP9WgOIEuDDmBtt
 B0vTcSVeBTd0tNpRRe5My/FqUjZBQuf9jpJsGRHaRUgfJxIxEqJ+8pHRSaKC6S6x
X-Gm-Gg: AR+sD13KRnd5o9lC81Tey8m2baE8fKrku5IFrTLsfF9o/B2eiKhfzMw3eRxzMit+iZ5
 RbeMFPCj0wVtVDWYA4IVYqCrQZ/KfFEACDTzCKlQLlmGfaU5LtgbVV+c+ONVhT6KvL7vZASNmY0
 ssstYRshBHfGwyO8OKdIfWuB1UAalPnmqcCGg841ksVIHMP9cRWWC8MV7SDrHS9qBE++2Xom2QR
 GRkhJr5xUlXsWrby272rRJoGG+/AYC7NaSqVyKUZme7S7PLWj4/eLpaTtCUg1UmQhqR7IzLChTl
 qAdMBpNv3rZWHAi01j5ApRip0E8ozQDsVEgheQ4zuKWEOwOrX4H+ii37ZZWBEf0RcfGbEeWx2yl
 WzMzol6kI1YY3wM6Tez+iScth5D3VVfEnC/5Uut51GNLfIuFiB6tjjKRD+b1/fdGRPLiIwa691M
 coR3o4RyqJ2VFV/INDzwXHxrxjzZu9oeS/ovPmeM3VFJVXJhsFt8N+3O5O8g1Bam2HOGL9oy3Mh
 Y6mTnVazTvtnUcW6N1WjN0pmwSOigFMM36QDiBTozHcqr0/61/67i+MuuI+HYY=
X-Received: by 2002:a05:600c:63c5:b0:493:c337:db0e with SMTP id
 5b1f17b1804b1-49800ea1838mr1755235e9.18.1785365705123; 
 Wed, 29 Jul 2026 15:55:05 -0700 (PDT)
Received: from localhost
 (sgyl-45-b2-v4wan-166941-cust3717.vm6.cable.virginm.net. [82.37.190.134])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-496fa4605c5sm93114435e9.1.2026.07.29.15.55.02
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 29 Jul 2026 15:55:03 -0700 (PDT)
From: Al Haji-Ali <abdo.haji.ali@HIDDEN>
To: Alan Third <alan@HIDDEN>, =?utf-8?Q?St=C3=A9phane?= Marks
 <shipmints@HIDDEN>
Subject: Re: bug#81510: 31.0.90; NS (macOS): clicking a disabled (:enable
 nil) tab-bar item crases Emacs
In-Reply-To: <amo8xVY9zoGqvYWr@HIDDEN>
References: <m1h5ljqgpe.fsf@HIDDEN> <86fr13ng3u.fsf@HIDDEN>
 <amj-iEQP6jaAgUqz@HIDDEN> <86a4rao7fa.fsf@HIDDEN>
 <CAN+1HbobEfagofi-Yv598xEJh-9e8CJptz5fG19GA2Z8ApSq3A@HIDDEN>
 <amo8xVY9zoGqvYWr@HIDDEN>
Date: Wed, 29 Jul 2026 23:52:17 +0100
Message-ID: <m21pcl76ji.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 81510
Cc: Eli Zaretskii <eliz@HIDDEN>, 81510 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)


On 29/07/2026, Alan Third wrote:
> Al Haji-Ali, are you able to check this fixes the problem for you too?

I have the same crash with this patch, it seems (btw, the issue is not
with an empty tab bar, but a disabled button), see the repro code I had
in my report.

I am not sure I fully understand the logic of the patch tbh.

The previous issue is that kbd_buffer_store_buffered_event is ultimately
called with: event->kind == NO_EVENT
which causes an emacs_abort();

This is caused in the current code because event->kind is initialized as
`NO_EVENT` and

(!(tab_bar_p && NILP (tab_bar_arg)))

is false (since in particular tab_bar_arg is NIL) and the value of kind
remains NO_EVENT.

In the patch the code:

if (tab_bar_p && NILP (tab_bar_arg))
    emacs_event->kind = NO_EVENT;

has the exact same effect, since the condition is flipped and
(tab_bar_p && NILP (tab_bar_arg))
is now true, leaving kind be NO_EVENT.

I see that w32term is doing the same thing, but I am not sure why it's
not crashing for you.

Best regards,
-- Al




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81510; Package emacs. Full text available.

Message received at 81510 <at> debbugs.gnu.org:


Received: (at 81510) by debbugs.gnu.org; 29 Jul 2026 17:48:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 29 13:48:02 2026
Received: from localhost ([127.0.0.1]:53373 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wp8Nt-0001P5-MW
	for submit <at> debbugs.gnu.org; Wed, 29 Jul 2026 13:48:02 -0400
Received: from dane.soverin.net ([2a10:de80:1:4092:b9e9:229e:0:1]:35637)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <alan@HIDDEN>) id 1wp8Nq-0001Oi-GO
 for 81510 <at> debbugs.gnu.org; Wed, 29 Jul 2026 13:48:00 -0400
Received: from smtp.soverin.net (unknown [10.10.4.100])
 (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 4h9KYL3tSwz6d;
 Wed, 29 Jul 2026 17:47:50 +0000 (UTC)
Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.100]) by
 soverin.net (Postfix) with ESMTPSA id 4h9KYL18n8z9j; 
 Wed, 29 Jul 2026 17:47:50 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin;
 t=1785347270; bh=Z/7PY+na7MHWK08j+oe9ppYgs0PkGbPGCWKCeb+bkSM=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
 b=QrCCkJ7ThXpHcUYmgwPSLRVOfurQQO25+BFuE579I6IquLGTLx9/g0uC/V0EhKJjc
 3tt2XVzKHdmd3IRjaa3MjxUoTEG461lPGt3JxoktTE8A1MqsMb2E0VYUtqE//zrnDD
 jL973WmxNX/aX85wbWyaMbYxqSh6FYuNExhmYhEFPXFmsBPUIefHMUU7JaYjDbsU7q
 W+d+JXJ8/eHJI+Eoa2292251nhbqk2Fo7TnnSP5/AG/UevG+e5y7uSNEAfyWEHgbpQ
 3mfZTRCvgk/WuIto/UoPQtl8Lw0/VxbNqlZy3b6CeSRJpUvAiXda75t/tTrTNMqp+x
 nkSbt928D1UBQ==
X-CM-Envelope: MS4xfDc5ijse9/lnVLWjVS828Ibt5upfS0VlR/dvVvHM99U5eX+6MlKiENp/xnqH5pGA2NFHLDXb3cWSFScy5XLp7tGmYNAbvM86zzd7lvDDZJUDqOVOAeX6
 msYCiN25uwBuy24z1jYXD/3SwhlyAQQxx9QR9ADOSmWg/AJOpKguO3UffE9+Tr1YSRTWqit9rD15SCF+GZRrEvMiqGthhvYPEuud7z+yiQL8O4XvlwPQzzzP
 R1BMMbYDqFYLacZnaLG8blGR12VSlHmIgu/7jlRFbjpeyfmv30XmCvPfI8K9qduVJsGgNQT1/MxXjbCB/YM2aQ==
X-Soverin-Id: 019faefd-6570-773f-9eab-aa2a379a4824
Received: from localhost (namib [local])
 by namib (OpenSMTPD) with ESMTPA id 9df178f5;
 Wed, 29 Jul 2026 17:47:49 +0000 (UTC)
Date: Wed, 29 Jul 2026 18:47:49 +0100
From: Alan Third <alan@HIDDEN>
To: =?iso-8859-1?Q?St=E9phane?= Marks <shipmints@HIDDEN>
Subject: Re: bug#81510: 31.0.90; NS (macOS): clicking a disabled (:enable
 nil) tab-bar item crases Emacs
Message-ID: <amo8xVY9zoGqvYWr@HIDDEN>
Mail-Followup-To: Alan Third <alan@HIDDEN>,
 =?iso-8859-1?Q?St=E9phane?= Marks <shipmints@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, abdo.haji.ali@HIDDEN,
 81510 <at> debbugs.gnu.org
References: <m1h5ljqgpe.fsf@HIDDEN> <86fr13ng3u.fsf@HIDDEN>
 <amj-iEQP6jaAgUqz@HIDDEN> <86a4rao7fa.fsf@HIDDEN>
 <CAN+1HbobEfagofi-Yv598xEJh-9e8CJptz5fG19GA2Z8ApSq3A@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="0JUh7TwI3ydsI+dR"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CAN+1HbobEfagofi-Yv598xEJh-9e8CJptz5fG19GA2Z8ApSq3A@HIDDEN>
X-Spampanel-Class: ham
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 81510
Cc: Eli Zaretskii <eliz@HIDDEN>, abdo.haji.ali@HIDDEN,
 81510 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--0JUh7TwI3ydsI+dR
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

On Wed, Jul 29, 2026 at 03:41:28PM +0200, Stéphane Marks wrote:
> On Tue, Jul 28, 2026 at 10:30 PM Eli Zaretskii <eliz@HIDDEN> wrote:
> 
> > > Date: Tue, 28 Jul 2026 20:10:00 +0100
> > > From: Alan Third <alan@HIDDEN>
> > > Cc: Al Haji-Ali <abdo.haji.ali@HIDDEN>, 81510 <at> debbugs.gnu.org
> > >
> > > On Tue, Jul 28, 2026 at 09:06:45PM +0300, Eli Zaretskii wrote:
> > > > > From: Al Haji-Ali <abdo.haji.ali@HIDDEN>
> > > > > Date: Tue, 28 Jul 2026 16:25:33 +0100
> > > > >
> > > > >
> > > > No, they both assign 'kind' unconditionally.  They then assign the
> > > > 'arg' member only if tab_bar_arg is non-nil.
> > > >
> > > > > Possible minimal fix: make handle_tab_bar_click's disabled-item
> > > > > branch return (Fcons (Qtab_bar, Qnil)) instead of bare Qnil, matching
> > > > > the "click missed" case, which nsterm.m (and presumably the other
> > > > > ports) already handle correctly as a harmless plain click. I haven't
> > > > > verified this doesn't have side effects for other callers of
> > > > > handle_tab_bar_click across the X11/w32 ports.
> > > >
> > > > I prefer that nsterm.m is changed to do the same we do in xterm.c and
> > > > w32term.c.  There's no need to change xdisp.c, which is a back-end
> > > > independent part of the display engine.
> > > >
> > > > Alan, WDYT?
> > >
> > > You mean something like this?
> >
> > Yes.
> >
> > > modified   src/nsterm.m
> > > @@ -7955,6 +7955,8 @@ - (void)mouseDown: (NSEvent *)theEvent
> > >        Lisp_Object tab_bar_arg = Qnil;
> > >        bool tab_bar_p = false;
> > >
> > > +      emacs_event->kind = MOUSE_CLICK_EVENT;
> > > +
> > >        if (WINDOWP (emacsframe->tab_bar_window)
> > >         && WINDOW_TOTAL_LINES (XWINDOW (emacsframe->tab_bar_window)))
> > >       {
> > > @@ -7971,9 +7973,12 @@ - (void)mouseDown: (NSEvent *)theEvent
> > >                                               EV_MODIFIERS (theEvent) |
> > EV_UDMODIFIERS (theEvent));
> > >       }
> > >
> > > -      if (!(tab_bar_p && NILP (tab_bar_arg)))
> > > -     emacs_event->kind = MOUSE_CLICK_EVENT;
> > > -      emacs_event->arg = tab_bar_arg;
> > > +      if (tab_bar_p && NILP (tab_bar_arg))
> > > +     emacs_event->kind = NO_EVENT;
> > > +
> > > +      if (!NILP (tab_bar_arg))
> > > +     emacs_event->arg = tab_bar_arg;
> > > +
> > >        emacs_event->code = EV_BUTTON (theEvent);
> > >        emacs_event->modifiers = EV_MODIFIERS (theEvent)
> > >                               | EV_UDMODIFIERS (theEvent);
> > >
> > > It looks functionally identical to me, but I don't really understand
> > > what's going on here...
> >
> > Does it fix the problem?
> >
> 
> Works for me.

Well, I guess I'll make it a proper patch, then.

Al Haji-Ali, are you able to check this fixes the problem for you too?
-- 
Alan Third

--0JUh7TwI3ydsI+dR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=0001-Fix-crash-when-clicking-on-empty-tab-bar-entry-bug-8.patch

From 89e1986ad4fd54c91cdec75125bcb738c31d5174 Mon Sep 17 00:00:00 2001
From: Alan Third <alan@HIDDEN>
Date: Wed, 29 Jul 2026 18:43:48 +0100
Subject: [PATCH] Fix crash when clicking on empty tab bar entry (bug#81510)

* src/nsterm.m: ([EmacsView mouseDown:]): Copy order of operations
regarding mouse clicks from the w32 port.
---
 src/nsterm.m | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index a7f3fc292c7..a2ef3f19fe3 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7955,6 +7955,8 @@ - (void)mouseDown: (NSEvent *)theEvent
       Lisp_Object tab_bar_arg = Qnil;
       bool tab_bar_p = false;
 
+      emacs_event->kind = MOUSE_CLICK_EVENT;
+
       if (WINDOWP (emacsframe->tab_bar_window)
 	  && WINDOW_TOTAL_LINES (XWINDOW (emacsframe->tab_bar_window)))
 	{
@@ -7971,9 +7973,12 @@ - (void)mouseDown: (NSEvent *)theEvent
 						EV_MODIFIERS (theEvent) | EV_UDMODIFIERS (theEvent));
 	}
 
-      if (!(tab_bar_p && NILP (tab_bar_arg)))
-	emacs_event->kind = MOUSE_CLICK_EVENT;
-      emacs_event->arg = tab_bar_arg;
+      if (tab_bar_p && NILP (tab_bar_arg))
+	emacs_event->kind = NO_EVENT;
+
+      if (!NILP (tab_bar_arg))
+	emacs_event->arg = tab_bar_arg;
+
       emacs_event->code = EV_BUTTON (theEvent);
       emacs_event->modifiers = EV_MODIFIERS (theEvent)
                              | EV_UDMODIFIERS (theEvent);
-- 
2.54.0


--0JUh7TwI3ydsI+dR--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81510; Package emacs. Full text available.

Message received at 81510 <at> debbugs.gnu.org:


Received: (at 81510) by debbugs.gnu.org; 29 Jul 2026 13:41:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 29 09:41:49 2026
Received: from localhost ([127.0.0.1]:52047 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wp4Xc-00086K-KN
	for submit <at> debbugs.gnu.org; Wed, 29 Jul 2026 09:41:49 -0400
Received: from mail-vs1-xe2a.google.com ([2607:f8b0:4864:20::e2a]:43125)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1wp4XZ-00085B-US
 for 81510 <at> debbugs.gnu.org; Wed, 29 Jul 2026 09:41:46 -0400
Received: by mail-vs1-xe2a.google.com with SMTP id
 ada2fe7eead31-7377dde7bc6so1323887137.0
 for <81510 <at> debbugs.gnu.org>; Wed, 29 Jul 2026 06:41:45 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1785332500; cv=none;
 d=google.com; s=arc-20260327;
 b=DR9lF86KIUdmEx5zliyDQRZYwLnxAOvCvKAqo4FyjAKevzWsvN81iGEcV1G840bshV
 GpQ7/fFS3MLF5wxbqNvl/ciwFd2ujTmTHMR2HAmM4ZqMEtsX4lbT1x41qun6xvAnGPTc
 0XeImW4oSOIs4mBhVsN7Ju2Fq3+BWfuO9hHuLmvctv6CNVAGs0gO06eVupIdauzhK3KI
 HfS04Hhu1/EkRwwVvERVMC9ccjHI4U5AkKQO2lSFokrdzyw3vNWZtiUeoIo9kTQ2BoOQ
 wsc7JtuOC/CI8YyoQIwvTTGus4KUexQET7112li4xMrhHb/PgxNWO8uuPx1ulVuF1RwR
 8rPQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
 s=arc-20260327; 
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:dkim-signature;
 bh=CoBRlwGAt0fnB8yU25hH9krkJJ9J0HbDbyW+rA2zX8E=;
 fh=9PLcgx+PH6mqH1AohqTY3k27grWVlTuCbp+jvtjtfaM=;
 b=FhRYcGiYquYmjbL/KBAsiLNBObpMxAzLxN8bGdgxgMobJMTjaIEJCbmLkUPcQnXXCW
 HpptG0iBPLCuap/XsWTIiJGfH2OaRc0Y+GpfzoVpB01Ya6YEiLeJ05gEcPJ2SF7IytvT
 l24/GuswPEtlrhSb51cpNp8s5bpuST66h5iANxl3rRI/lVGRpyBfNihvdGjDQS4Ts2ht
 BM9fE/URfgYcz9jojLrIy7tpP+GXsTaegYghUePYWFcSHccOvVDZW3VG8OGzveVhDqp3
 2ZSR4YJcf2i38wTB/qvH5Ga1Z+ngvRgNMPl/YBn9IJNLkkPYmjO1F8aIztY1NAvuooK7
 gQug==; darn=debbugs.gnu.org
ARC-Authentication-Results: i=1; mx.google.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1785332500; x=1785937300; darn=debbugs.gnu.org;
 h=content-type:cc:to:subject:message-id:date:from:in-reply-to
 :references:mime-version:from:to:cc:subject:date:message-id:reply-to
 :content-type; bh=CoBRlwGAt0fnB8yU25hH9krkJJ9J0HbDbyW+rA2zX8E=;
 b=J//nV5d5Qv01cg4y6HMY5Orj56sOjmCz21F/iXXxZIzPAuVjrmVzBfM0UZB1zwJOs3
 rPyCqptFU8sC95VH2UKAS9ojDsSKstk1ptSY4k6dV6bGuRxeRkF1mlZXU/PHUwrLc94w
 HBGUYj8LH/No3lYY1ntURu8M+lvlLKElTbzNBJ8Q3eRtwujaixJM5kEM6a1FWqK8QJuo
 2NRS9UwF86CMXZFKwPTkuhrMGM0fS6C80Yg9hnyyzp7yZ9cn4EndS6tAs9A7txbVCMMT
 4kr2oOPTIRErCMbD/1nv1aLyTWypNt2Bct6bZGiqROcjp0KVRSQl7ahNgIJG9Z6J6mE5
 /bVA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1785332500; x=1785937300;
 h=content-type:cc:to:subject:message-id:date:from:in-reply-to
 :references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to:content-type;
 bh=CoBRlwGAt0fnB8yU25hH9krkJJ9J0HbDbyW+rA2zX8E=;
 b=PrkqhPRD8lJOvdRTCHQgej9OeC5N0g2/R/IS5w5XMSfcsHCjWBo4dQSN/IsNSuVjdo
 aBBkwRjUni/s02+sGN2Tb+EcTQsAZ2kWX0APG3o8+2HqYeVd/KoiQvJN5RY44jl7v9mz
 Y52Cs0Fkl/wycCHxomzHYRQn+Dl7WpdHpezAOpoOn9SCV4/NJ2YENS7hVBclb8g2mVDK
 QOcSKxmlDP6WeqiBN+uCqupxsXJsP6PqXdhlW95JzLcIA+R6tD9ereVWB1LkS47g8HMZ
 ydPY3Y+/qW9OuKgCXp7TAHhQmU4ONDarohBJXvVuIrnVpDl/tvFm+qcfq4hzySzpimo8
 ufdQ==
X-Forwarded-Encrypted: i=1;
 AHgh+RoOfRxK1X3mVEH3Ojk+0SqmS7C8u9ls9LXrOH17GVa9CjQW5silaVa9h+3/zJ32GzEu5kKe4g==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Yw2kJpK4FazY8C9OFu4k3nZB5oqY7mfRvX2Wk1sj7WtOTtcjesO
 Nfp0KZ100ANyqsxG5fiIGDD26MaxGyvg13K9fPj+ZK1kynC8KqamEMNkSHGRy0WwSlNo6Tf+WUE
 iP0vEPrWXhtPt/CEuq5H7wqB8MWefbrw=
X-Gm-Gg: AR+sD107Inz+6DVGqH1wzb5IRkBZVuN/qLgUjYKnNE667KaN7ky87wphSUAvx13L5jt
 0OFLsEP8g+l7gJMNMMvCxr6jf8aJcugVsCKO6M8ydV4FNXJaPduSDulgq87F8V9p3YBaTHXIWuH
 mJGEXhuLoW/UeCqf2k7r6YGwKbdcXJ52tMiezxQSzjcdtiK/SWOrY4Aw34caDG9XLIkz4A1ifxs
 jblLfWiegFt0T/3o/92ROOUelM89aGc+OUMPsXgk11UMAonrNpv77UC4g654wn8N4+Mv8Wal+Ji
 VoQa/mmEG3VVNCKHpi+99TGfKd1vcTXttx5Hz4oelCsHAcsgPtFtSUs9JAKqhkxv2EeRdijtjcR
 08ntfZFHZWIds+qKJMdB8cbSCQPx0WH3WJ0srJ9h10xaFo09MGanqI9m3OveXYsueibg9WvK7NF
 h0GTZbBImjWwo7wWL3bgJeufdS2YnV/uy7Yd+tuuTnyLgyNEIo35Bva3BDKjYEoUEm7Qw=
X-Received: by 2002:a05:6102:1481:b0:650:94b2:b214 with SMTP id
 ada2fe7eead31-7560a5a86c3mr761132137.12.1785332500198; Wed, 29 Jul 2026
 06:41:40 -0700 (PDT)
MIME-Version: 1.0
References: <m1h5ljqgpe.fsf@HIDDEN> <86fr13ng3u.fsf@HIDDEN>
 <amj-iEQP6jaAgUqz@HIDDEN> <86a4rao7fa.fsf@HIDDEN>
In-Reply-To: <86a4rao7fa.fsf@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Wed, 29 Jul 2026 15:41:28 +0200
X-Gm-Features: AUfX_myrU08QP82Y8prBy7_OeOVe77UszxQytdRfyq2CVv-gbGGNkGxNoOWiQCg
Message-ID: <CAN+1HbobEfagofi-Yv598xEJh-9e8CJptz5fG19GA2Z8ApSq3A@HIDDEN>
Subject: Re: bug#81510: 31.0.90; NS (macOS): clicking a disabled (:enable nil)
 tab-bar item crases Emacs
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000007af6f90657c01d6d"
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 81510
Cc: Alan Third <alan@HIDDEN>, abdo.haji.ali@HIDDEN,
 81510 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

--0000000000007af6f90657c01d6d
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, Jul 28, 2026 at 10:30=E2=80=AFPM Eli Zaretskii <eliz@HIDDEN> wrote=
:

> > Date: Tue, 28 Jul 2026 20:10:00 +0100
> > From: Alan Third <alan@HIDDEN>
> > Cc: Al Haji-Ali <abdo.haji.ali@HIDDEN>, 81510 <at> debbugs.gnu.org
> >
> > On Tue, Jul 28, 2026 at 09:06:45PM +0300, Eli Zaretskii wrote:
> > > > From: Al Haji-Ali <abdo.haji.ali@HIDDEN>
> > > > Date: Tue, 28 Jul 2026 16:25:33 +0100
> > > >
> > > >
> > > No, they both assign 'kind' unconditionally.  They then assign the
> > > 'arg' member only if tab_bar_arg is non-nil.
> > >
> > > > Possible minimal fix: make handle_tab_bar_click's disabled-item
> > > > branch return (Fcons (Qtab_bar, Qnil)) instead of bare Qnil, matchi=
ng
> > > > the "click missed" case, which nsterm.m (and presumably the other
> > > > ports) already handle correctly as a harmless plain click. I haven'=
t
> > > > verified this doesn't have side effects for other callers of
> > > > handle_tab_bar_click across the X11/w32 ports.
> > >
> > > I prefer that nsterm.m is changed to do the same we do in xterm.c and
> > > w32term.c.  There's no need to change xdisp.c, which is a back-end
> > > independent part of the display engine.
> > >
> > > Alan, WDYT?
> >
> > You mean something like this?
>
> Yes.
>
> > modified   src/nsterm.m
> > @@ -7955,6 +7955,8 @@ - (void)mouseDown: (NSEvent *)theEvent
> >        Lisp_Object tab_bar_arg =3D Qnil;
> >        bool tab_bar_p =3D false;
> >
> > +      emacs_event->kind =3D MOUSE_CLICK_EVENT;
> > +
> >        if (WINDOWP (emacsframe->tab_bar_window)
> >         && WINDOW_TOTAL_LINES (XWINDOW (emacsframe->tab_bar_window)))
> >       {
> > @@ -7971,9 +7973,12 @@ - (void)mouseDown: (NSEvent *)theEvent
> >                                               EV_MODIFIERS (theEvent) |
> EV_UDMODIFIERS (theEvent));
> >       }
> >
> > -      if (!(tab_bar_p && NILP (tab_bar_arg)))
> > -     emacs_event->kind =3D MOUSE_CLICK_EVENT;
> > -      emacs_event->arg =3D tab_bar_arg;
> > +      if (tab_bar_p && NILP (tab_bar_arg))
> > +     emacs_event->kind =3D NO_EVENT;
> > +
> > +      if (!NILP (tab_bar_arg))
> > +     emacs_event->arg =3D tab_bar_arg;
> > +
> >        emacs_event->code =3D EV_BUTTON (theEvent);
> >        emacs_event->modifiers =3D EV_MODIFIERS (theEvent)
> >                               | EV_UDMODIFIERS (theEvent);
> >
> > It looks functionally identical to me, but I don't really understand
> > what's going on here...
>
> Does it fix the problem?
>

Works for me.

--0000000000007af6f90657c01d6d
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif;b=
ackground-color:transparent">On Tue, Jul 28, 2026 at 10:30=E2=80=AFPM Eli Z=
aretskii &lt;<a href=3D"mailto:eliz@HIDDEN">eliz@HIDDEN</a>&gt; wrote:</s=
pan></div></div><div class=3D"gmail_quote gmail_quote_container"><blockquot=
e class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px s=
olid rgb(204,204,204);padding-left:1ex">&gt; Date: Tue, 28 Jul 2026 20:10:0=
0 +0100<br>
&gt; From: Alan Third &lt;<a href=3D"mailto:alan@HIDDEN" target=3D"_bla=
nk">alan@HIDDEN</a>&gt;<br>
&gt; Cc: Al Haji-Ali &lt;<a href=3D"mailto:abdo.haji.ali@HIDDEN" target=
=3D"_blank">abdo.haji.ali@HIDDEN</a>&gt;, <a href=3D"mailto:81510@debbug=
s.gnu.org" target=3D"_blank">81510 <at> debbugs.gnu.org</a><br>
&gt; <br>
&gt; On Tue, Jul 28, 2026 at 09:06:45PM +0300, Eli Zaretskii wrote:<br>
&gt; &gt; &gt; From: Al Haji-Ali &lt;<a href=3D"mailto:abdo.haji.ali@gmail.=
com" target=3D"_blank">abdo.haji.ali@HIDDEN</a>&gt;<br>
&gt; &gt; &gt; Date: Tue, 28 Jul 2026 16:25:33 +0100<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; <br>
&gt; &gt; No, they both assign &#39;kind&#39; unconditionally.=C2=A0 They t=
hen assign the<br>
&gt; &gt; &#39;arg&#39; member only if tab_bar_arg is non-nil.<br>
&gt; &gt; <br>
&gt; &gt; &gt; Possible minimal fix: make handle_tab_bar_click&#39;s disabl=
ed-item<br>
&gt; &gt; &gt; branch return (Fcons (Qtab_bar, Qnil)) instead of bare Qnil,=
 matching<br>
&gt; &gt; &gt; the &quot;click missed&quot; case, which nsterm.m (and presu=
mably the other<br>
&gt; &gt; &gt; ports) already handle correctly as a harmless plain click. I=
 haven&#39;t<br>
&gt; &gt; &gt; verified this doesn&#39;t have side effects for other caller=
s of<br>
&gt; &gt; &gt; handle_tab_bar_click across the X11/w32 ports.<br>
&gt; &gt; <br>
&gt; &gt; I prefer that nsterm.m is changed to do the same we do in xterm.c=
 and<br>
&gt; &gt; w32term.c.=C2=A0 There&#39;s no need to change xdisp.c, which is =
a back-end<br>
&gt; &gt; independent part of the display engine.<br>
&gt; &gt; <br>
&gt; &gt; Alan, WDYT?<br>
&gt; <br>
&gt; You mean something like this?<br>
<br>
Yes.<br>
<br>
&gt; modified=C2=A0 =C2=A0src/nsterm.m<br>
&gt; @@ -7955,6 +7955,8 @@ - (void)mouseDown: (NSEvent *)theEvent<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 Lisp_Object tab_bar_arg =3D Qnil;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 bool tab_bar_p =3D false;<br>
&gt;=C2=A0 <br>
&gt; +=C2=A0 =C2=A0 =C2=A0 emacs_event-&gt;kind =3D MOUSE_CLICK_EVENT;<br>
&gt; +<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (WINDOWP (emacsframe-&gt;tab_bar_window)=
<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;&amp; WINDOW_TOTAL_LINES (XWINDO=
W (emacsframe-&gt;tab_bar_window)))<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0{<br>
&gt; @@ -7971,9 +7973,12 @@ - (void)mouseDown: (NSEvent *)theEvent<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0EV_MODIFIERS (theEvent) | EV_UDMODIFIERS (theEvent)=
);<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>
&gt;=C2=A0 <br>
&gt; -=C2=A0 =C2=A0 =C2=A0 if (!(tab_bar_p &amp;&amp; NILP (tab_bar_arg)))<=
br>
&gt; -=C2=A0 =C2=A0 =C2=A0emacs_event-&gt;kind =3D MOUSE_CLICK_EVENT;<br>
&gt; -=C2=A0 =C2=A0 =C2=A0 emacs_event-&gt;arg =3D tab_bar_arg;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 if (tab_bar_p &amp;&amp; NILP (tab_bar_arg))<br>
&gt; +=C2=A0 =C2=A0 =C2=A0emacs_event-&gt;kind =3D NO_EVENT;<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 if (!NILP (tab_bar_arg))<br>
&gt; +=C2=A0 =C2=A0 =C2=A0emacs_event-&gt;arg =3D tab_bar_arg;<br>
&gt; +<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 emacs_event-&gt;code =3D EV_BUTTON (theEven=
t);<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 emacs_event-&gt;modifiers =3D EV_MODIFIERS =
(theEvent)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| EV_UDMODIFIERS (theEvent);<br>
&gt; <br>
&gt; It looks functionally identical to me, but I don&#39;t really understa=
nd<br>
&gt; what&#39;s going on here...<br>
<br>
Does it fix the problem?<br></blockquote><div><br></div><div class=3D"gmail=
_default" style=3D"font-family:monospace">Works for me.</div></div></div>

--0000000000007af6f90657c01d6d--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81510; Package emacs. Full text available.

Message received at 81510 <at> debbugs.gnu.org:


Received: (at 81510) by debbugs.gnu.org; 29 Jul 2026 02:29:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 28 22:29:10 2026
Received: from localhost ([127.0.0.1]:50106 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wou2f-0006qU-PD
	for submit <at> debbugs.gnu.org; Tue, 28 Jul 2026 22:29:10 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34614)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wou2c-0006py-JP
 for 81510 <at> debbugs.gnu.org; Tue, 28 Jul 2026 22:29:07 -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 <eliz@HIDDEN>)
 id 1wou2W-0004Oa-OM; Tue, 28 Jul 2026 22:29:00 -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=irwLcigARU4OAamOmQDVaSQWeTNmm8/DdW0r/kqdGYE=; b=aY1UglUOHjph
 jK57YNRZFOKHTxr4u29y7SLHeRKuZmjfvjHrEio/+RqxOf6gAAr6kqqLgXe00U3dzwKD/y7buH/Rv
 jlBlEMK29uPWYb69YkqtarDbVh5bJ1DN7iaU/3BAgbM8qnrHNn/qviLHyWNUthhB2tJSwM9cxQZqU
 DoMFbZ/YOFn6bNd7Vuy2A98sl38jWWb+FOBJff3WdYeQ1PfzJsp4qLdKSqp8CGn02JmdzAr8tP2G6
 XxzhF3nT5WfGwA+7UDRLAWcXR2dhZnQoFqSlKp8yidgAMYkEUczkn9uebKesanKOWOsefT5KTGT0j
 zTsCNAesdnbNHujo7VxCLA==;
Date: Wed, 29 Jul 2026 05:28:57 +0300
Message-Id: <86a4rao7fa.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Alan Third <alan@HIDDEN>
In-Reply-To: <amj-iEQP6jaAgUqz@HIDDEN> (message from Alan
 Third on Tue, 28 Jul 2026 20:10:00 +0100)
Subject: Re: bug#81510: 31.0.90; NS (macOS): clicking a disabled (:enable
 nil) tab-bar item crases Emacs
References: <m1h5ljqgpe.fsf@HIDDEN>
 <86fr13ng3u.fsf@HIDDEN> <amj-iEQP6jaAgUqz@HIDDEN>
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 81510
Cc: abdo.haji.ali@HIDDEN, 81510 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> Date: Tue, 28 Jul 2026 20:10:00 +0100
> From: Alan Third <alan@HIDDEN>
> Cc: Al Haji-Ali <abdo.haji.ali@HIDDEN>, 81510 <at> debbugs.gnu.org
> 
> On Tue, Jul 28, 2026 at 09:06:45PM +0300, Eli Zaretskii wrote:
> > > From: Al Haji-Ali <abdo.haji.ali@HIDDEN>
> > > Date: Tue, 28 Jul 2026 16:25:33 +0100
> > > 
> > > 
> > No, they both assign 'kind' unconditionally.  They then assign the
> > 'arg' member only if tab_bar_arg is non-nil.
> > 
> > > Possible minimal fix: make handle_tab_bar_click's disabled-item
> > > branch return (Fcons (Qtab_bar, Qnil)) instead of bare Qnil, matching
> > > the "click missed" case, which nsterm.m (and presumably the other
> > > ports) already handle correctly as a harmless plain click. I haven't
> > > verified this doesn't have side effects for other callers of
> > > handle_tab_bar_click across the X11/w32 ports.
> > 
> > I prefer that nsterm.m is changed to do the same we do in xterm.c and
> > w32term.c.  There's no need to change xdisp.c, which is a back-end
> > independent part of the display engine.
> > 
> > Alan, WDYT?
> 
> You mean something like this?

Yes.

> modified   src/nsterm.m
> @@ -7955,6 +7955,8 @@ - (void)mouseDown: (NSEvent *)theEvent
>        Lisp_Object tab_bar_arg = Qnil;
>        bool tab_bar_p = false;
>  
> +      emacs_event->kind = MOUSE_CLICK_EVENT;
> +
>        if (WINDOWP (emacsframe->tab_bar_window)
>  	  && WINDOW_TOTAL_LINES (XWINDOW (emacsframe->tab_bar_window)))
>  	{
> @@ -7971,9 +7973,12 @@ - (void)mouseDown: (NSEvent *)theEvent
>  						EV_MODIFIERS (theEvent) | EV_UDMODIFIERS (theEvent));
>  	}
>  
> -      if (!(tab_bar_p && NILP (tab_bar_arg)))
> -	emacs_event->kind = MOUSE_CLICK_EVENT;
> -      emacs_event->arg = tab_bar_arg;
> +      if (tab_bar_p && NILP (tab_bar_arg))
> +	emacs_event->kind = NO_EVENT;
> +
> +      if (!NILP (tab_bar_arg))
> +	emacs_event->arg = tab_bar_arg;
> +
>        emacs_event->code = EV_BUTTON (theEvent);
>        emacs_event->modifiers = EV_MODIFIERS (theEvent)
>                               | EV_UDMODIFIERS (theEvent);
> 
> It looks functionally identical to me, but I don't really understand
> what's going on here...

Does it fix the problem?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81510; Package emacs. Full text available.

Message received at 81510 <at> debbugs.gnu.org:


Received: (at 81510) by debbugs.gnu.org; 28 Jul 2026 19:10:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 28 15:10:10 2026
Received: from localhost ([127.0.0.1]:46668 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wonBq-0003DI-5w
	for submit <at> debbugs.gnu.org; Tue, 28 Jul 2026 15:10:10 -0400
Received: from dane.soverin.net ([2a10:de80:1:4091:b9e9:2215:0:1]:33653)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <alan@HIDDEN>) id 1wonBo-0003D2-Kt
 for 81510 <at> debbugs.gnu.org; Tue, 28 Jul 2026 15:10:09 -0400
Received: from smtp.soverin.net (unknown [10.10.4.100])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange x25519) (No client certificate requested)
 by dane.soverin.net (Postfix) with ESMTPS id 4h8lQf2zlmzdb;
 Tue, 28 Jul 2026 19:10:02 +0000 (UTC)
Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.100]) by
 soverin.net (Postfix) with ESMTPSA id 4h8lQd6XHVzFX; 
 Tue, 28 Jul 2026 19:10:01 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin;
 t=1785265802; bh=V33QxaUn3wfi9isHGFRAthrolWiCnkEQRhJ7BFTdd8M=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
 b=EzNnpFWo7cmhYZgf/R++6xH4nEK708eo5l8wYsRSakiXWOcmn4DgXxCKQWviUZSa3
 fNTN31L4KK2BJrGFgifYK8INEqKTxOlRhB0tS3Uc/ty5LiNx32X3uU1RMs0rmP0lJD
 EHLAMCITR7ray9T88LXfgwtMT5RP8NRbiqOjG4CFHxz8ENwKg4h4LcEB4MpFjJO1Af
 qF9uzpRDKga1lsUwphxDKkeipho8QfGr92D5bA64/itcXgY4nT52pQLlQYSUlKjTBt
 uUcAxrYmEFlCnYUVjWhHfkoFksATh9y8ldXDgEp7/whfI24dKYfHopa/s93upFzKAL
 VcGvQiBRkGnyg==
X-CM-Envelope: MS4xfE30eLO983mfaZb1ZRQtNPrph2bv5Dl4+lkBViVb+dm4BUNOmEKdMBF0Szs20la3nY4fg++1aKjn/E6Zx/vdQCCDw9vCI8AJWE5rEDK7BhXz/Kt+LLUZ
 zNRVMVXrsLEkvEDrTVvDW+wxQ0Jl93Fw/7FVYUWePwaDlewIdUqeOM2v1p1Ncp7QD7jThaqk4wBBq4RMsg5qrQkfn75LGnxFCzIQtYqkiz4R3PZvpkpLk98w
 8iisUtZBkQQu2THUHqFnTub3Isss0Aa9IJK0DHyhZNCyogaRPzj6bve7Q6L3OJnf
X-Soverin-Id: 019faa22-4b10-78eb-ad38-63cd4eed8abe
Received: from localhost (namib [local])
 by namib (OpenSMTPD) with ESMTPA id 0b18372e;
 Tue, 28 Jul 2026 19:10:00 +0000 (UTC)
Date: Tue, 28 Jul 2026 20:10:00 +0100
From: Alan Third <alan@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#81510: 31.0.90; NS (macOS): clicking a disabled (:enable
 nil) tab-bar item crases Emacs
Message-ID: <amj-iEQP6jaAgUqz@HIDDEN>
Mail-Followup-To: Alan Third <alan@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, Al Haji-Ali <abdo.haji.ali@HIDDEN>,
 81510 <at> debbugs.gnu.org
References: <m1h5ljqgpe.fsf@HIDDEN>
 <86fr13ng3u.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <86fr13ng3u.fsf@HIDDEN>
X-Spampanel-Class: ham
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 81510
Cc: Al Haji-Ali <abdo.haji.ali@HIDDEN>, 81510 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

On Tue, Jul 28, 2026 at 09:06:45PM +0300, Eli Zaretskii wrote:
> > From: Al Haji-Ali <abdo.haji.ali@HIDDEN>
> > Date: Tue, 28 Jul 2026 16:25:33 +0100
> > 
> > 
> No, they both assign 'kind' unconditionally.  They then assign the
> 'arg' member only if tab_bar_arg is non-nil.
> 
> > Possible minimal fix: make handle_tab_bar_click's disabled-item
> > branch return (Fcons (Qtab_bar, Qnil)) instead of bare Qnil, matching
> > the "click missed" case, which nsterm.m (and presumably the other
> > ports) already handle correctly as a harmless plain click. I haven't
> > verified this doesn't have side effects for other callers of
> > handle_tab_bar_click across the X11/w32 ports.
> 
> I prefer that nsterm.m is changed to do the same we do in xterm.c and
> w32term.c.  There's no need to change xdisp.c, which is a back-end
> independent part of the display engine.
> 
> Alan, WDYT?

You mean something like this?

modified   src/nsterm.m
@@ -7955,6 +7955,8 @@ - (void)mouseDown: (NSEvent *)theEvent
       Lisp_Object tab_bar_arg = Qnil;
       bool tab_bar_p = false;
 
+      emacs_event->kind = MOUSE_CLICK_EVENT;
+
       if (WINDOWP (emacsframe->tab_bar_window)
 	  && WINDOW_TOTAL_LINES (XWINDOW (emacsframe->tab_bar_window)))
 	{
@@ -7971,9 +7973,12 @@ - (void)mouseDown: (NSEvent *)theEvent
 						EV_MODIFIERS (theEvent) | EV_UDMODIFIERS (theEvent));
 	}
 
-      if (!(tab_bar_p && NILP (tab_bar_arg)))
-	emacs_event->kind = MOUSE_CLICK_EVENT;
-      emacs_event->arg = tab_bar_arg;
+      if (tab_bar_p && NILP (tab_bar_arg))
+	emacs_event->kind = NO_EVENT;
+
+      if (!NILP (tab_bar_arg))
+	emacs_event->arg = tab_bar_arg;
+
       emacs_event->code = EV_BUTTON (theEvent);
       emacs_event->modifiers = EV_MODIFIERS (theEvent)
                              | EV_UDMODIFIERS (theEvent);

It looks functionally identical to me, but I don't really understand
what's going on here...
-- 
Alan Third




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81510; Package emacs. Full text available.

Message received at 81510 <at> debbugs.gnu.org:


Received: (at 81510) by debbugs.gnu.org; 28 Jul 2026 18:06:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 28 14:06:59 2026
Received: from localhost ([127.0.0.1]:46107 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1womCd-0005Wv-QH
	for submit <at> debbugs.gnu.org; Tue, 28 Jul 2026 14:06:58 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:35674)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1womCb-0005Vs-8Q
 for 81510 <at> debbugs.gnu.org; Tue, 28 Jul 2026 14:06:54 -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 <eliz@HIDDEN>)
 id 1womCV-0002Ox-HF; Tue, 28 Jul 2026 14:06:47 -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=fQIo1Uqh+ZeUTzNiMarv2WPcMyPSenw/O14ndux+Hik=; b=aDK/VzAZxuUR
 DKuuF6yGHsABauArJ6O0vpfGci82IMWKP9/T+BGjbn+DVDZd8fLtyqHFFEaJSJmf5LdxwDcVl/mrG
 JC5m1LFgb8VH5NYiMXrjeB3N5Q6FvJ40yIbRPj9Z55nLuRWamO7uI4avMEBxhxqDy7ofkOPgeaYek
 b/vxRXV+RQ42O/8Ze1lhO9LEiEhUH9Frt4ts7drDWgxidvMpoLwKaK+bWtQoqMOv0pujfd/8jkUf4
 EXCiqUwKW2fXsNSJQwNOHF3njgl/3gU9KcqvqwGErq3GHdFXpLcpRM7ThrPmIdzkt5PsqWvVSmQL/
 /Gt8AtEgGZ0JLVBt8/nL+A==;
Date: Tue, 28 Jul 2026 21:06:45 +0300
Message-Id: <86fr13ng3u.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Al Haji-Ali <abdo.haji.ali@HIDDEN>, Alan Third <alan@HIDDEN>
In-Reply-To: <m1h5ljqgpe.fsf@HIDDEN> (message from Al Haji-Ali on Tue, 28
 Jul 2026 16:25:33 +0100)
Subject: Re: bug#81510: 31.0.90;
 NS (macOS): clicking a disabled (:enable nil) tab-bar item crases
 Emacs
References: <m1h5ljqgpe.fsf@HIDDEN>
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 81510
Cc: 81510 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> From: Al Haji-Ali <abdo.haji.ali@HIDDEN>
> Date: Tue, 28 Jul 2026 16:25:33 +0100
> 
> 
> Clicking a tab-bar menu-item that has an explicit `:enable nil' property
> (i.e. a disabled item) crashes Emacs outright on the NS (macOS) port.
> 
> Minimal recipe:
> 
>     emacs -Q -l repro.el
> 
> where repro.el contains:
> 
>     (defun repro-tab-bar-format ()
>       '((disabled-item menu-item "disabled item -- click me" ignore
>          :enable nil)))
>     (setq tab-bar-format '(repro-tab-bar-format))
>     (tab-bar-mode 1)
> 
> Then click on the "disabled item -- click me" text in the tab bar and
> note the crash.
> 
> Backtrace (macOS crash report, Thread 0):
> 
>     0   libsystem_kernel.dylib   __pthread_kill + 8
>     1   libsystem_pthread.dylib  pthread_kill + 296
>     2   libsystem_c.dylib        raise + 32
>     3   Emacs                    terminate_due_to_signal + 228
>     4   Emacs                    emacs_abort + 20
>     5   Emacs                    kbd_buffer_store_buffered_event + 652
>     6   Emacs                    ns_read_socket_1 + 112
>     7   Emacs                    gobble_input + 264
>     ...
>     -[EmacsView mouseDown:]
> 
> Root cause, as far as I can tell from reading src/xdisp.c,
> src/keyboard.c and src/nsterm.m:
> 
> 1. keyboard.c's parse_tab_bar_item defaults TAB_BAR_ITEM_ENABLED_P to t,
>    and an explicit `:enable FORM' property overrides it.
> 
> 2. xdisp.c's handle_tab_bar_click returns nil on a disabled item, rather
>    than (Fcons (Qtab_bar, Qnil)) like a missed clicked.
> 
> 3. nsterm.m's -[EmacsView mouseDown:] does:
> 
>        if (!(tab_bar_p && NILP (tab_bar_arg)))
>          emacs_event->kind = MOUSE_CLICK_EVENT;
>        ...
>        EV_TRAILER (theEvent);
> 
>    For a disabled item, emacs_event->kind is never assigned -- it's left
>    at its default, NO_EVENT. EV_TRAILER then calls
>    kbd_buffer_store_event_hold.
> 
> 4. keyboard.c's kbd_buffer_store_buffered_event opens with:
> 
>        if (event->kind == NO_EVENT)
>          emacs_abort ();
> 
> I have not tested on X11/w32, so I am not sure if they have the same
> issue.

No, they both assign 'kind' unconditionally.  They then assign the
'arg' member only if tab_bar_arg is non-nil.

> Possible minimal fix: make handle_tab_bar_click's disabled-item
> branch return (Fcons (Qtab_bar, Qnil)) instead of bare Qnil, matching
> the "click missed" case, which nsterm.m (and presumably the other
> ports) already handle correctly as a harmless plain click. I haven't
> verified this doesn't have side effects for other callers of
> handle_tab_bar_click across the X11/w32 ports.

I prefer that nsterm.m is changed to do the same we do in xterm.c and
w32term.c.  There's no need to change xdisp.c, which is a back-end
independent part of the display engine.

Alan, WDYT?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81510; Package emacs. Full text available.

Message received at 81510 <at> debbugs.gnu.org:


Received: (at 81510) by debbugs.gnu.org; 28 Jul 2026 17:08:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 28 13:08:48 2026
Received: from localhost ([127.0.0.1]:45990 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wolIK-0003Bd-PS
	for submit <at> debbugs.gnu.org; Tue, 28 Jul 2026 13:08:48 -0400
Received: from mail-vs1-xe29.google.com ([2607:f8b0:4864:20::e29]:50585)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1wolIE-00039e-VM
 for 81510 <at> debbugs.gnu.org; Tue, 28 Jul 2026 13:08:42 -0400
Received: by mail-vs1-xe29.google.com with SMTP id
 ada2fe7eead31-73791ee3612so6877137.1
 for <81510 <at> debbugs.gnu.org>; Tue, 28 Jul 2026 10:08:38 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1785258513; cv=none;
 d=google.com; s=arc-20260327;
 b=TWt7LyAb8vRqtbgXaRasdeou2FqIzi3iYZ9+z1h854cqhrSpigLLZ4fZi1u63ieW5G
 MAnpTPkkxvC1LsTBlIhSDy3N4SNXe1SdZ0t+UcCm5hcj7287dHCafaY3ZdR6fNFTG3fM
 2hXetGdhCcNfwxp2JPmM6E5BzKNExPWCCwRqjS+MM+1yZrh/4Cze74SraXWJBgb8zsNl
 17+0hzw/mcUuTKNP1qM8CQTt2FFEYz8I698AO2PPXcmxpW+4NCJGIBFf41pgaRMgmjUC
 3AusC6lFnwnEuZ4ObDQiqc46Kbx8GE44u6CHhTCpSZ3HNzRmCiXPJyYATc+9KbF8gR8P
 TMCw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
 s=arc-20260327; 
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:dkim-signature;
 bh=7pv2BkmucwBvXZZS3JUwq2T0xBTwBBRhBl/mYSdOwmw=;
 fh=7XD3grIgEcLQnmzgwYCz/ricKoRdQU+XzS+LqXeAzPI=;
 b=cIubATzgyRnQSrOr+Ka0JTLLEO0bTA5mRStIWniwIbTbMtpLpT0pal3TTN3QnGL1UK
 7cCyHWYXwRyTqMbv8RaOUZHNFz8Net2PXzf8hEBRSsSmkGOVhUxiolaP5vXVMxuuerK1
 LUMxV/FaBDeaK439Nf5LLBd06lgIo8GtfFMNYWEhI58bRr+zFrVfkM9QfnoHT3WxXuBs
 OPUX1EW/DbbCydkYvY1NS/ZP2jNo2R8D7lRw/TY/0SjgOSnrDhh/JBH3Qy+BtfdTb2cz
 bo0AfQ/7jG154xRsUU80/ugouyjcSjriKu52nLPoUd703NR3LQBVxmtmuhiwI8QxiiCV
 wKDw==; darn=debbugs.gnu.org
ARC-Authentication-Results: i=1; mx.google.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1785258513; x=1785863313; darn=debbugs.gnu.org;
 h=content-type:cc:to:subject:message-id:date:from:in-reply-to
 :references:mime-version:from:to:cc:subject:date:message-id:reply-to
 :content-type; bh=7pv2BkmucwBvXZZS3JUwq2T0xBTwBBRhBl/mYSdOwmw=;
 b=IEdBOLShZ+kTvhYui8ernhRNo6KaVI233NLpoK2kzgJrBfxAXtvE0d478GGyAV1c7Q
 dD5BvE7Zm4k4SdryDSLJbj4ez/ArNBHUkwQ/LekIoGMw/cPO37HgF0RlR4tv35akePnz
 Bs01+NXrk+rUCXfzH0xPZ6CS2Yg30Ga7N0xcJU6f79HoylnkeWLCbSB1b6wRkPPB486/
 5AoJIgUpeMK+41CPuDwUdb0C+CejvlfQo4MW58ECChPD5Dtp/DFcuZg42XtBaYWWaOiC
 0e0pyphfgSCb2pGxXocLKptuFjyk3vVinxiR27H/OHcsVxxuSleRmJv9Wqrli/jCQ7qN
 FKXg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1785258513; x=1785863313;
 h=content-type:cc:to:subject:message-id:date:from:in-reply-to
 :references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to:content-type;
 bh=7pv2BkmucwBvXZZS3JUwq2T0xBTwBBRhBl/mYSdOwmw=;
 b=mG+QWLsSW9TGOYayRoIAzLpgoPfwfv+DCzjcF8ZZio+O77xUiKnsEZWIY4862Q8QGK
 rimsldaViBaEIBUBnhOpxbT/Q7+0DzTxU7CPrtJlENZI2VpQcI3EarA8yUYsWayVpuDD
 DmHoRZ4HTIxlUbSsT3uIOkrQ/Kugdw4R+TZxoPdojElq7rak4IICjGLj+PY74x9xRLzk
 1exmPC/otmHsRt8sBZCP59kdXrVLz3Ni0h81nqMKOFH/WSL/+DhlDk4YhmandwnhpLFG
 43T4sT31Ol78E+I32TMgFmJ394j7XthkJLY/+uSyiKLQvMw3DLIXbvuYB6KXzJ6EnJ9J
 1pEA==
X-Gm-Message-State: AOJu0YyspZpEPkd+GLFbhRGs55Ioxw/0lief5/bCKR1l/5otL2sOdZu3
 e6hjDvmh3gu6GzccdWz9GGaerRJAMSaVQE/my0b9k4GWUOZBkk4TMbWHezJWap8L/4oynE3r0m9
 Gw/l7XeEO05nwfVb5mwy+oxhpU0jChTk=
X-Gm-Gg: AR+sD112a90PEaEkGwYI2+uqUG5VLT1LzAgphCc5+mP7bDmA1ZUFOJtG2dRuI2UWwe0
 IDoXh8JV9SRm15OqjSUAo0iYsB0HTCt2b7mJCj0EPbT4Gcx0oVgq3d1IpgY3/7DEgaqapWV046G
 IMg/yUss7281PQDT+BRrAIiC7gNoqhGAGoa8RJgBMs4ZYizA89EyGywNkn9sxkPoayVE7P8NQYK
 YTkl9nipzIYFtY5sU+pagVdNMhLbqLd1dZWmNVAQpqmPGsHmslVyIAMOMlqxb3JNjHd8LQIATPl
 ihPtJ5BSooOBjEyF0aaCbHrAHjKBvfPIHqvIqZb+0E1NTn70YDa8GsLTghEWaJDZo+HFOzjvvi9
 6yTeUem6dg4+AHdPGmOjKTCgnVVkGbh6WVyKLHKs85pKh7Ho9JNTMqJgZ0MnidAxGffv8L1/3wp
 lfj6J0O1Lc
X-Received: by 2002:a05:6102:148b:b0:739:5cfb:50f4 with SMTP id
 ada2fe7eead31-7549fd622f4mr1919480137.11.1785258513010; Tue, 28 Jul 2026
 10:08:33 -0700 (PDT)
MIME-Version: 1.0
References: <m1h5ljqgpe.fsf@HIDDEN>
In-Reply-To: <m1h5ljqgpe.fsf@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Tue, 28 Jul 2026 19:08:21 +0200
X-Gm-Features: AUfX_mze9M-J_8l7u8Hk6WUkygDEp_Ro_g8lsa30Daw3PzjE0qvY3U1Kv5-6UBc
Message-ID: <CAN+1Hbpoj5+kqHubK-c19GGBN83YkKzsXdpcphdBS3wVQsdJrQ@HIDDEN>
Subject: Re: bug#81510: 31.0.90; NS (macOS): clicking a disabled (:enable nil)
 tab-bar item crases Emacs
To: Al Haji-Ali <abdo.haji.ali@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000008014e10657aee395"
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 81510
Cc: Alan Third <alan@HIDDEN>, 81510 <at> debbugs.gnu.org,
 Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

--0000000000008014e10657aee395
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, Jul 28, 2026 at 11:31=E2=80=AFAM Al Haji-Ali <abdo.haji.ali@HIDDEN=
om>
wrote:

>
> Clicking a tab-bar menu-item that has an explicit `:enable nil' property
> (i.e. a disabled item) crashes Emacs outright on the NS (macOS) port.
>
> Minimal recipe:
>
>     emacs -Q -l repro.el
>
> where repro.el contains:
>
>     (defun repro-tab-bar-format ()
>       '((disabled-item menu-item "disabled item -- click me" ignore
>          :enable nil)))
>     (setq tab-bar-format '(repro-tab-bar-format))
>     (tab-bar-mode 1)
>
> Then click on the "disabled item -- click me" text in the tab bar and
> note the crash.
>
> Backtrace (macOS crash report, Thread 0):
>
>     0   libsystem_kernel.dylib   __pthread_kill + 8
>     1   libsystem_pthread.dylib  pthread_kill + 296
>     2   libsystem_c.dylib        raise + 32
>     3   Emacs                    terminate_due_to_signal + 228
>     4   Emacs                    emacs_abort + 20
>     5   Emacs                    kbd_buffer_store_buffered_event + 652
>     6   Emacs                    ns_read_socket_1 + 112
>     7   Emacs                    gobble_input + 264
>     ...
>     -[EmacsView mouseDown:]
>
> Root cause, as far as I can tell from reading src/xdisp.c,
> src/keyboard.c and src/nsterm.m:
>
> 1. keyboard.c's parse_tab_bar_item defaults TAB_BAR_ITEM_ENABLED_P to t,
>    and an explicit `:enable FORM' property overrides it.
>
> 2. xdisp.c's handle_tab_bar_click returns nil on a disabled item, rather
>    than (Fcons (Qtab_bar, Qnil)) like a missed clicked.
>
> 3. nsterm.m's -[EmacsView mouseDown:] does:
>
>        if (!(tab_bar_p && NILP (tab_bar_arg)))
>          emacs_event->kind =3D MOUSE_CLICK_EVENT;
>        ...
>        EV_TRAILER (theEvent);
>
>    For a disabled item, emacs_event->kind is never assigned -- it's left
>    at its default, NO_EVENT. EV_TRAILER then calls
>    kbd_buffer_store_event_hold.
>
> 4. keyboard.c's kbd_buffer_store_buffered_event opens with:
>
>        if (event->kind =3D=3D NO_EVENT)
>          emacs_abort ();
>
> I have not tested on X11/w32, so I am not sure if they have the same
> issue.
>
> Possible minimal fix: make handle_tab_bar_click's disabled-item
> branch return (Fcons (Qtab_bar, Qnil)) instead of bare Qnil, matching
> the "click missed" case, which nsterm.m (and presumably the other
> ports) already handle correctly as a harmless plain click. I haven't
> verified this doesn't have side effects for other callers of
> handle_tab_bar_click across the X11/w32 ports.
>
> ------------------
>
> In GNU Emacs 31.0.90 (build 1, aarch64-apple-darwin25.5.0, NS
>  appkit-2685.60 Version 26.5.1 (Build 25F80)) of 2026-07-12 built on
>  HW-R9XXWKPJ4D
> Windowing system distributor 'Apple', version 10.3.2685
> System Description:  macOS 26.5.2
>
> Configured using:
>  'configure --disable-dependency-tracking --disable-silent-rules
>  --enable-locallisppath=3D/opt/homebrew/share/emacs/site-lisp
>  --infodir=3D/opt/homebrew/Cellar/emacs-plus@31/31.0.90/share/info/emacs
>  --prefix=3D/opt/homebrew/Cellar/emacs-plus@31/31.0.90
>  --with-native-compilation=3Daot --with-xml2 --with-gnutls
>  --without-compress-install 'CFLAGS=3D-DFD_SETSIZE=3D10000
>  -DDARWIN_UNLIMITED_SELECT -I/opt/homebrew/opt/sqlite/include
>  -I/opt/homebrew/opt/gcc/include -I/opt/homebrew/opt/libgccjit/include'
>  --without-dbus --without-imagemagick --with-modules --with-rsvg
>  --with-webp --with-ns --disable-ns-self-contained
>  'LDFLAGS=3D-L/opt/homebrew/opt/sqlite/lib -L/opt/homebrew/lib/gcc/16
>  -Wl,-rpath,/opt/homebrew/lib/gcc/16''
>
> Configured features:
> ACL GIF GLIB GMP GNUTLS JPEG 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 $LANG: en_GB.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
>   minibuffer-nonselected-mode: t
>   minibuffer-regexp-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 comp-run bytecomp byte-compile comp-common rx
> emacsbug lisp-mnt 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 subr-x mm-decode mm-bodies
> mm-encode mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail
> mail-parse rfc2231 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 kqueue cocoa ns lcms2
> multi-tty make-network-process tty-child-frames native-compile emacs)
>
> Memory information:
> ((conses 16 56258 9223) (symbols 48 6141 0) (strings 32 15274 1404)
>  (string-bytes 1 530642) (vectors 16 9719)
>  (vector-slots 8 134388 10017) (floats 8 22 2) (intervals 56 266 0)
>  (buffers 1064 10))
>

+ other people

Good catch.  At first glance, your proposal looks right.

diff --git a/src/xdisp.c b/src/xdisp.c
index 5377d5e8ada..81dcbb543be 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -15321,7 +15321,7 @@ handle_tab_bar_click (struct frame *f, int x, int
y, bool down_p,
   /* If item is disabled, do nothing.  */
   enabled_p =3D AREF (f->tab_bar_items, prop_idx + TAB_BAR_ITEM_ENABLED_P)=
;
   if (NILP (enabled_p))
-    return Qnil;
+    return Fcons (Qtab_bar, Qnil);

   if (down_p)
     {

Let's see what others think.

-St=C3=A9phane

--0000000000008014e10657aee395
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif;b=
ackground-color:transparent">On Tue, Jul 28, 2026 at 11:31=E2=80=AFAM Al Ha=
ji-Ali &lt;<a href=3D"mailto:abdo.haji.ali@HIDDEN">abdo.haji.ali@HIDDEN=
om</a>&gt; wrote:</span></div></div><div class=3D"gmail_quote gmail_quote_c=
ontainer"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8=
ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Clicking a tab-bar menu-item that has an explicit `:enable nil&#39; propert=
y<br>
(i.e. a disabled item) crashes Emacs outright on the NS (macOS) port.<br>
<br>
Minimal recipe:<br>
<br>
=C2=A0 =C2=A0 emacs -Q -l repro.el<br>
<br>
where repro.el contains:<br>
<br>
=C2=A0 =C2=A0 (defun repro-tab-bar-format ()<br>
=C2=A0 =C2=A0 =C2=A0 &#39;((disabled-item menu-item &quot;disabled item -- =
click me&quot; ignore<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0:enable nil)))<br>
=C2=A0 =C2=A0 (setq tab-bar-format &#39;(repro-tab-bar-format))<br>
=C2=A0 =C2=A0 (tab-bar-mode 1)<br>
<br>
Then click on the &quot;disabled item -- click me&quot; text in the tab bar=
 and<br>
note the crash.<br>
<br>
Backtrace (macOS crash report, Thread 0):<br>
<br>
=C2=A0 =C2=A0 0=C2=A0 =C2=A0libsystem_kernel.dylib=C2=A0 =C2=A0__pthread_ki=
ll + 8<br>
=C2=A0 =C2=A0 1=C2=A0 =C2=A0libsystem_pthread.dylib=C2=A0 pthread_kill + 29=
6<br>
=C2=A0 =C2=A0 2=C2=A0 =C2=A0libsystem_c.dylib=C2=A0 =C2=A0 =C2=A0 =C2=A0 ra=
ise + 32<br>
=C2=A0 =C2=A0 3=C2=A0 =C2=A0Emacs=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 terminate_due_to_signal + 228<br>
=C2=A0 =C2=A0 4=C2=A0 =C2=A0Emacs=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 emacs_abort + 20<br>
=C2=A0 =C2=A0 5=C2=A0 =C2=A0Emacs=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 kbd_buffer_store_buffered_event + 652<br>
=C2=A0 =C2=A0 6=C2=A0 =C2=A0Emacs=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ns_read_socket_1 + 112<br>
=C2=A0 =C2=A0 7=C2=A0 =C2=A0Emacs=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 gobble_input + 264<br>
=C2=A0 =C2=A0 ...<br>
=C2=A0 =C2=A0 -[EmacsView mouseDown:]<br>
<br>
Root cause, as far as I can tell from reading src/xdisp.c,<br>
src/keyboard.c and src/nsterm.m:<br>
<br>
1. keyboard.c&#39;s parse_tab_bar_item defaults TAB_BAR_ITEM_ENABLED_P to t=
,<br>
=C2=A0 =C2=A0and an explicit `:enable FORM&#39; property overrides it.<br>
<br>
2. xdisp.c&#39;s handle_tab_bar_click returns nil on a disabled item, rathe=
r<br>
=C2=A0 =C2=A0than (Fcons (Qtab_bar, Qnil)) like a missed clicked.<br>
<br>
3. nsterm.m&#39;s -[EmacsView mouseDown:] does:<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!(tab_bar_p &amp;&amp; NILP (tab_bar_arg)))<=
br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0emacs_event-&gt;kind =3D MOUSE_CLICK_EVEN=
T;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0...<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0EV_TRAILER (theEvent);<br>
<br>
=C2=A0 =C2=A0For a disabled item, emacs_event-&gt;kind is never assigned --=
 it&#39;s left<br>
=C2=A0 =C2=A0at its default, NO_EVENT. EV_TRAILER then calls<br>
=C2=A0 =C2=A0kbd_buffer_store_event_hold.<br>
<br>
4. keyboard.c&#39;s kbd_buffer_store_buffered_event opens with:<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0if (event-&gt;kind =3D=3D NO_EVENT)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0emacs_abort ();<br>
<br>
I have not tested on X11/w32, so I am not sure if they have the same<br>
issue.<br>
<br>
Possible minimal fix: make handle_tab_bar_click&#39;s disabled-item<br>
branch return (Fcons (Qtab_bar, Qnil)) instead of bare Qnil, matching<br>
the &quot;click missed&quot; case, which nsterm.m (and presumably the other=
<br>
ports) already handle correctly as a harmless plain click. I haven&#39;t<br=
>
verified this doesn&#39;t have side effects for other callers of<br>
handle_tab_bar_click across the X11/w32 ports.<br>
<br>
------------------<br>
<br>
In GNU Emacs 31.0.90 (build 1, aarch64-apple-darwin25.5.0, NS<br>
=C2=A0appkit-2685.60 Version 26.5.1 (Build 25F80)) of 2026-07-12 built on<b=
r>
=C2=A0HW-R9XXWKPJ4D<br>
Windowing system distributor &#39;Apple&#39;, version 10.3.2685<br>
System Description:=C2=A0 macOS 26.5.2<br>
<br>
Configured using:<br>
=C2=A0&#39;configure --disable-dependency-tracking --disable-silent-rules<b=
r>
=C2=A0--enable-locallisppath=3D/opt/homebrew/share/emacs/site-lisp<br>
=C2=A0--infodir=3D/opt/homebrew/Cellar/emacs-plus@31/31.0.90/share/info/ema=
cs<br>
=C2=A0--prefix=3D/opt/homebrew/Cellar/emacs-plus@31/31.0.90<br>
=C2=A0--with-native-compilation=3Daot --with-xml2 --with-gnutls<br>
=C2=A0--without-compress-install &#39;CFLAGS=3D-DFD_SETSIZE=3D10000<br>
=C2=A0-DDARWIN_UNLIMITED_SELECT -I/opt/homebrew/opt/sqlite/include<br>
=C2=A0-I/opt/homebrew/opt/gcc/include -I/opt/homebrew/opt/libgccjit/include=
&#39;<br>
=C2=A0--without-dbus --without-imagemagick --with-modules --with-rsvg<br>
=C2=A0--with-webp --with-ns --disable-ns-self-contained<br>
=C2=A0&#39;LDFLAGS=3D-L/opt/homebrew/opt/sqlite/lib -L/opt/homebrew/lib/gcc=
/16<br>
=C2=A0-Wl,-rpath,/opt/homebrew/lib/gcc/16&#39;&#39;<br>
<br>
Configured features:<br>
ACL GIF GLIB GMP GNUTLS JPEG LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY<br>
KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS<br>
TREE_SITTER WEBP XIM ZLIB<br>
<br>
Important settings:<br>
=C2=A0 value of $LANG: en_GB.UTF-8<br>
=C2=A0 locale-coding-system: utf-8-unix<br>
<br>
Major mode: Lisp Interaction<br>
<br>
Minor modes in effect:<br>
=C2=A0 tooltip-mode: t<br>
=C2=A0 global-eldoc-mode: t<br>
=C2=A0 eldoc-mode: t<br>
=C2=A0 show-paren-mode: t<br>
=C2=A0 electric-indent-mode: t<br>
=C2=A0 mouse-wheel-mode: t<br>
=C2=A0 tool-bar-mode: t<br>
=C2=A0 menu-bar-mode: t<br>
=C2=A0 file-name-shadow-mode: t<br>
=C2=A0 global-font-lock-mode: t<br>
=C2=A0 font-lock-mode: t<br>
=C2=A0 blink-cursor-mode: t<br>
=C2=A0 minibuffer-nonselected-mode: t<br>
=C2=A0 minibuffer-regexp-mode: t<br>
=C2=A0 line-number-mode: t<br>
=C2=A0 indent-tabs-mode: t<br>
=C2=A0 transient-mark-mode: t<br>
=C2=A0 auto-composition-mode: t<br>
=C2=A0 auto-encryption-mode: t<br>
=C2=A0 auto-compression-mode: t<br>
<br>
Load-path shadows:<br>
None found.<br>
<br>
Features:<br>
(shadow sort mail-extr comp-run bytecomp byte-compile comp-common rx<br>
emacsbug lisp-mnt message mailcap yank-media puny dired dired-loaddefs<br>
rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config<br>
gnus-util text-property-search time-date subr-x mm-decode mm-bodies<br>
mm-encode mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail<br>
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util mail-prsvr<br>
mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify<br>
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win<br=
>
ucs-normalize mule-util term/common-win tool-bar dnd fontset image<br>
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode<br>
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu<br>
timer select scroll-bar mouse jit-lock font-lock syntax font-core<br>
term/tty-colors frame minibuffer nadvice seq simple cl-generic<br>
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese<br>
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek<br>
romanian slovak czech european ethiopic indian cyrillic chinese<br>
composite emoji-zwj charscript charprop case-table epa-hook<br>
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs<br>
theme-loaddefs faces cus-face macroexp files window text-properties<br>
overlay sha1 md5 base64 format env code-pages mule custom widget keymap<br>
hashtable-print-readable backquote threads kqueue cocoa ns lcms2<br>
multi-tty make-network-process tty-child-frames native-compile emacs)<br>
<br>
Memory information:<br>
((conses 16 56258 9223) (symbols 48 6141 0) (strings 32 15274 1404)<br>
=C2=A0(string-bytes 1 530642) (vectors 16 9719)<br>
=C2=A0(vector-slots 8 134388 10017) (floats 8 22 2) (intervals 56 266 0)<br=
>
=C2=A0(buffers 1064 10))<br></blockquote><div><br></div><div class=3D"gmail=
_default" style=3D"font-family:monospace">+ other people</div><div class=3D=
"gmail_default" style=3D"font-family:monospace"><br></div><div class=3D"gma=
il_default" style=3D"font-family:monospace">Good catch.=C2=A0 At first glan=
ce, your proposal looks right.</div><div class=3D"gmail_default" style=3D"f=
ont-family:monospace"><br></div><div class=3D"gmail_default" style=3D"font-=
family:monospace">diff --git a/src/xdisp.c b/src/xdisp.c<br>index 5377d5e8a=
da..81dcbb543be 100644<br>--- a/src/xdisp.c<br>+++ b/src/xdisp.c<br>@@ -153=
21,7 +15321,7 @@ handle_tab_bar_click (struct frame *f, int x, int y, bool =
down_p,<br>=C2=A0 =C2=A0/* If item is disabled, do nothing. =C2=A0*/<br>=C2=
=A0 =C2=A0enabled_p =3D AREF (f-&gt;tab_bar_items, prop_idx + TAB_BAR_ITEM_=
ENABLED_P);<br>=C2=A0 =C2=A0if (NILP (enabled_p))<br>- =C2=A0 =C2=A0return =
Qnil;<br>+ =C2=A0 =C2=A0return Fcons (Qtab_bar, Qnil);<br>=C2=A0<br>=C2=A0 =
=C2=A0if (down_p)<br>=C2=A0 =C2=A0 =C2=A0{<br></div><div class=3D"gmail_def=
ault" style=3D"font-family:monospace"><br></div><div class=3D"gmail_default=
" style=3D"font-family:monospace">Let&#39;s see what others think.</div><di=
v class=3D"gmail_default" style=3D"font-family:monospace"><br></div><div cl=
ass=3D"gmail_default" style=3D"font-family:monospace">-St=C3=A9phane</div><=
/div></div>

--0000000000008014e10657aee395--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#81510; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 28 Jul 2026 15:30:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 28 11:30:27 2026
Received: from localhost ([127.0.0.1]:45738 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wojl7-00023h-1y
	for submit <at> debbugs.gnu.org; Tue, 28 Jul 2026 11:30:26 -0400
Received: from lists1p.gnu.org ([2001:470:142::17]:46872)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <abdo.haji.ali@HIDDEN>)
 id 1wojkz-0001ye-DY
 for submit <at> debbugs.gnu.org; Tue, 28 Jul 2026 11:30:18 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <abdo.haji.ali@HIDDEN>)
 id 1wojks-0005wL-Qv
 for bug-gnu-emacs@HIDDEN; Tue, 28 Jul 2026 11:30:07 -0400
Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <abdo.haji.ali@HIDDEN>)
 id 1wojkq-0001BX-EF
 for bug-gnu-emacs@HIDDEN; Tue, 28 Jul 2026 11:30:06 -0400
Received: by mail-wm1-x331.google.com with SMTP id
 5b1f17b1804b1-4955158f26aso25903795e9.3
 for <bug-gnu-emacs@HIDDEN>; Tue, 28 Jul 2026 08:30:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1785252603; x=1785857403; darn=gnu.org;
 h=content-type:mime-version:message-id:date:subject:to:from:from:to
 :cc:subject:date:message-id:reply-to:content-type;
 bh=yoxtO45KfFVsH61YqZ3WfnDgQu5teeN8bo2KP0wIgus=;
 b=p2eIzEmODcjZylg6UFXyLQzj8oYqhhJNPTzab0TY3qHxXorH4dCBTcx+eJOheUDTL2
 wkoXRiOmix/UFjDGXPWtOnmxYJ2gu75os0uHEWEJWVQNrqhRVAVRoJsP4zX/TnsazxTB
 KnPqaDpXHj2qn1leupxEoYWk488tP/yeZFzcSbmpNqBHct5H/t+x0NCdvlD6oHYPLPpm
 YRJJmIGRdTmr2P4M1tZXjZiRUY6Nd4qFO4f1UKOvbTUpTcLhrkfgLcYwbAxTgcdSHzDt
 RG/kqRWmXjJ5qLzp7wTcCjwqrK7lrlbM7EpHZdiXmHEDcRjJUcvwjfFKAcVmugJWBehk
 pjrA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1785252603; x=1785857403;
 h=content-type:mime-version:message-id:date:subject:to:from:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
 :content-type;
 bh=yoxtO45KfFVsH61YqZ3WfnDgQu5teeN8bo2KP0wIgus=;
 b=FXvDqyVKlSZmrLheI7ztW15dF2DkHEpad7QXJDssVNAK0NmwssSggPE1rUB79dzU83
 y7te/4w2m1R7xE11hgp7SHygjQqrLrgHYTkTUmutH2VAipHfMMDsxwCuL0HHQfFRJOhH
 b0ZCR/DSSwxRjzKTJmWJWg/ghK5Be7joU1D5btjXRpHItTSsnyy7SeSpbb8nuGFCKM/X
 pbgMS1v7VDBgfSvH+WSClEu64P+bBmvQty2YZXLj7S9QW7pjSlUP2/7crA1eYSRPKXK9
 OQADTKHOC5DbiH6nsmeP4QnvCh81/SsmiFpK55E0sd1yv4mw8UnZSK5A32cpAt+to+BT
 AaLA==
X-Gm-Message-State: AOJu0YyymGoWDoRUjuxA1UyI+za7TCpQvaCUvtVj09mCBtZdGjQmLvur
 RJX7ABWjIXMBv8TgiJSqRET1eAbnzxQ6m9jj6FlqUDvwvHUUmbKHjmoEozQsrQ==
X-Gm-Gg: AR+sD12LGxD7crR2VyRUL1bdRorJNXq9HjKsqBnJM9m3XSdVrKSqW7EZNcPVHWf0X8Y
 OhnB9tP6w2srUsnYTSypOkNS7ikAwqlUAbyeV0jjhm3oD7xo8+9tJUozyCmnR+BAsYaVMrG7xr+
 /RBv7IxpvRWAzrBWn1tsk2fMNp9UbjwI4OPW8H71SUY9DgA4nvU8OHee+31k3D9BTOICmWLK3tA
 GP/gNXvesQwetRyJmE/RQQt2RLL91NlfuJmMeUHlm4Ip55N0eYwltC3K3HV1JGsW1cfuCMkdHMT
 tdSGeWuhL5ccSgZ7oRDZgwWpk/fKtbTxzY/+3yEvMMAbNr1GwYqlBqNk3F2Ge9uEVAcOpRHpjxb
 nv7CRypP3/fiXz7QKrqHUUrKjyfwNsATLHooBLRRSVYkMEeyq2VtqMr4qOh0qTrvckBauSXwEi2
 Cfgdg/bWq+WGY8LfCk7qfRseI=
X-Received: by 2002:a05:600c:8b86:b0:495:3af9:4cfe with SMTP id
 5b1f17b1804b1-496c657d248mr30548395e9.20.1785252602404; 
 Tue, 28 Jul 2026 08:30:02 -0700 (PDT)
Received: from localhost ([137.195.27.88]) by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-496c45cb960sm78884045e9.9.2026.07.28.08.30.01
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 28 Jul 2026 08:30:01 -0700 (PDT)
From: Al Haji-Ali <abdo.haji.ali@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 31.0.90; NS (macOS): clicking a disabled (:enable nil) tab-bar item
 crases Emacs
Date: Tue, 28 Jul 2026 16:25:33 +0100
Message-ID: <m1h5ljqgpe.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2a00:1450:4864:20::331;
 envelope-from=abdo.haji.ali@HIDDEN; helo=mail-wm1-x331.google.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, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Clicking a tab-bar menu-item that has an explicit `:enable
 nil' property (i.e. a disabled item) crashes Emacs outright on the NS (macOS)
 port. Minimal recipe: emacs -Q -l repro.el 
 Content analysis details:   (2.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 1.0 FORGED_GMAIL_RCVD      'From' gmail.com does not match 'Received'
 headers
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (abdo.haji.ali[at]gmail.com)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)


Clicking a tab-bar menu-item that has an explicit `:enable nil' property
(i.e. a disabled item) crashes Emacs outright on the NS (macOS) port.

Minimal recipe:

    emacs -Q -l repro.el

where repro.el contains:

    (defun repro-tab-bar-format ()
      '((disabled-item menu-item "disabled item -- click me" ignore
         :enable nil)))
    (setq tab-bar-format '(repro-tab-bar-format))
    (tab-bar-mode 1)

Then click on the "disabled item -- click me" text in the tab bar and
note the crash.

Backtrace (macOS crash report, Thread 0):

    0   libsystem_kernel.dylib   __pthread_kill + 8
    1   libsystem_pthread.dylib  pthread_kill + 296
    2   libsystem_c.dylib        raise + 32
    3   Emacs                    terminate_due_to_signal + 228
    4   Emacs                    emacs_abort + 20
    5   Emacs                    kbd_buffer_store_buffered_event + 652
    6   Emacs                    ns_read_socket_1 + 112
    7   Emacs                    gobble_input + 264
    ...
    -[EmacsView mouseDown:]

Root cause, as far as I can tell from reading src/xdisp.c,
src/keyboard.c and src/nsterm.m:

1. keyboard.c's parse_tab_bar_item defaults TAB_BAR_ITEM_ENABLED_P to t,
   and an explicit `:enable FORM' property overrides it.

2. xdisp.c's handle_tab_bar_click returns nil on a disabled item, rather
   than (Fcons (Qtab_bar, Qnil)) like a missed clicked.

3. nsterm.m's -[EmacsView mouseDown:] does:

       if (!(tab_bar_p && NILP (tab_bar_arg)))
         emacs_event->kind = MOUSE_CLICK_EVENT;
       ...
       EV_TRAILER (theEvent);

   For a disabled item, emacs_event->kind is never assigned -- it's left
   at its default, NO_EVENT. EV_TRAILER then calls
   kbd_buffer_store_event_hold.

4. keyboard.c's kbd_buffer_store_buffered_event opens with:

       if (event->kind == NO_EVENT)
         emacs_abort ();

I have not tested on X11/w32, so I am not sure if they have the same
issue.

Possible minimal fix: make handle_tab_bar_click's disabled-item
branch return (Fcons (Qtab_bar, Qnil)) instead of bare Qnil, matching
the "click missed" case, which nsterm.m (and presumably the other
ports) already handle correctly as a harmless plain click. I haven't
verified this doesn't have side effects for other callers of
handle_tab_bar_click across the X11/w32 ports.

------------------

In GNU Emacs 31.0.90 (build 1, aarch64-apple-darwin25.5.0, NS
 appkit-2685.60 Version 26.5.1 (Build 25F80)) of 2026-07-12 built on
 HW-R9XXWKPJ4D
Windowing system distributor 'Apple', version 10.3.2685
System Description:  macOS 26.5.2

Configured using:
 'configure --disable-dependency-tracking --disable-silent-rules
 --enable-locallisppath=/opt/homebrew/share/emacs/site-lisp
 --infodir=/opt/homebrew/Cellar/emacs-plus@31/31.0.90/share/info/emacs
 --prefix=/opt/homebrew/Cellar/emacs-plus@31/31.0.90
 --with-native-compilation=aot --with-xml2 --with-gnutls
 --without-compress-install 'CFLAGS=-DFD_SETSIZE=10000
 -DDARWIN_UNLIMITED_SELECT -I/opt/homebrew/opt/sqlite/include
 -I/opt/homebrew/opt/gcc/include -I/opt/homebrew/opt/libgccjit/include'
 --without-dbus --without-imagemagick --with-modules --with-rsvg
 --with-webp --with-ns --disable-ns-self-contained
 'LDFLAGS=-L/opt/homebrew/opt/sqlite/lib -L/opt/homebrew/lib/gcc/16
 -Wl,-rpath,/opt/homebrew/lib/gcc/16''

Configured features:
ACL GIF GLIB GMP GNUTLS JPEG 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 $LANG: en_GB.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
  minibuffer-nonselected-mode: t
  minibuffer-regexp-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 comp-run bytecomp byte-compile comp-common rx
emacsbug lisp-mnt 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 subr-x mm-decode mm-bodies
mm-encode mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail
mail-parse rfc2231 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 kqueue cocoa ns lcms2
multi-tty make-network-process tty-child-frames native-compile emacs)

Memory information:
((conses 16 56258 9223) (symbols 48 6141 0) (strings 32 15274 1404)
 (string-bytes 1 530642) (vectors 16 9719)
 (vector-slots 8 134388 10017) (floats 8 22 2) (intervals 56 266 0)
 (buffers 1064 10))




Acknowledgement sent to Al Haji-Ali <abdo.haji.ali@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#81510; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 30 Jul 2026 15:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.