Received: (at 72496) by debbugs.gnu.org; 29 Aug 2026 09:58:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 29 05:58:28 2026
Received: from localhost ([127.0.0.1]:54823 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1x0FpR-0000jE-Et
for submit <at> debbugs.gnu.org; Sat, 29 Aug 2026 05:58:28 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:41256)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1x0FpO-0000iN-Nt
for 72496 <at> debbugs.gnu.org; Sat, 29 Aug 2026 05:58:23 -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 1x0FpJ-0003IN-Am; Sat, 29 Aug 2026 05:58:17 -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=WF+TniehD84osVYTRbrmsQM/V6JglKnSulIAUs4+FDU=; b=mleNam8dmz6n
uCTbRYVQkkHzyfiiI/+FYInXEBZ5wCyDlCJo1q7RMgR2VmaQ4nhJCIslKcTzeM8padWhfCX9x4rFF
kZNv2nVQRIIqQj0ngoKtL6WcSSXgJ2jr/YfaIvaH6TMsDI2S/r+VyE8V3Zt8rxnFcsaJp/pOj8zIF
URPmJydJWHg2v2iTlBfBN3SHvjL5C6W/NyDXMbRDLp0k6pcBjCOxoXNNjTITUeQ8l19H+H/oIWGGh
UWuOE+uWtrkkugRtS9qK2MiEDDyFqsy0eAS/92AZSmx7N0NTyKOm+ou2EhkR8oveuVk0y71JEeLIX
c5zc20rNIsX4lGFmKvo1PQ==;
Date: Sat, 29 Aug 2026 12:58:14 +0300
Message-Id: <86tsodb64p.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: plug.rifling_5y@HIDDEN, alan@HIDDEN, shipmints@HIDDEN
In-Reply-To: <86wltq6635.fsf@HIDDEN> (message from Eli Zaretskii on Sun, 16
Aug 2026 07:29:34 +0300)
Subject: Re: bug#72496: 31.0.50 macOS: freezes without beach ball
References: <m2ikwd6a8w.fsf@HIDDEN>
<79FC9978-BB6D-4B3B-B4C9-AC94E59D8987@HIDDEN> <86ldane926.fsf@HIDDEN>
<anCyFdt6EHnGVGmz@HIDDEN> <86h5kv7cfm.fsf@HIDDEN>
<aoB9CpacnQyANyft@HIDDEN> <864igv76sf.fsf@HIDDEN>
<E59EB6B8-A01D-4A40-946F-E6AA1929B6D9@HIDDEN> <86wltq6635.fsf@HIDDEN>
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 72496
Cc: 72496 <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 (-)
Ping! How can we make progress with this issue?
> Cc: Alan Third <alan@HIDDEN>, shipmints@HIDDEN, 72496 <at> debbugs.gnu.org
> Date: Sun, 16 Aug 2026 07:29:34 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
>
> [Please always use Reply to All to reply, to keep everyone CC'ed.]
>
> > From: plug.rifling_5y@HIDDEN
> > Date: Sat, 15 Aug 2026 20:29:19 +0100
> >
> >
> > Thanks for attention to this issue!
> >
> > I just also wanted to share a follow up on this from my side:
> >
> > I have also recently found a different case for the same symptom, and I have made a separate patch for that issue as well. Please see both of these patches attached.
> > After these two fixes I no longer experience this Emacs freezing problem on my side.
> >
> > Thanks a lot!
> >
> >
> > Recover when the appdefined event that ends [NSApp run] is dropped.
> >
> > Companion to emacs-30-ns-appdefined-windownumber.patch, which makes the event
> > carry a window number that exists. That is necessary but not sufficient: a
> > freeze reproduced on 2026-08-03 wedged an Emacs built *with* that patch, with
> > two visible frames whose window numbers were both valid.
> >
> > `ns_read_socket_1' posts one application-defined event and then calls
> > [NSApp run], which returns only when that event comes back through
> > -[EmacsApp sendEvent:]. AppKit can still fail to deliver it while key/main
> > status is being handed over -- app activation, a second frame taking focus, a
> > frame being miniaturized. In the observed hang the last thing logged before
> > the stall was a focus change, and afterwards [NSApp mainWindow] and
> > [NSApp keyWindow] were both nil and stayed nil: even activating the app and
> > calling makeKeyAndOrderFront: left AppKit refusing to give either window key
> > status, and -[EmacsApp sendEvent:] was never reached again.
> >
> > What makes that fatal is the missing recovery path, not the drop itself. By
> > the time the event is posted `send_appdefined' is already NO, so every later
> > EV_TRAILER re-post is suppressed, and `timed_entry' has just been invalidated,
> > so no timer can wake the loop. One dropped event hangs Emacs forever: the UI
> > keeps redrawing but never accepts input again, and only Force Quit ends it.
> >
> > So keep re-posting until [NSApp run] actually exits. The timer is scheduled
> > only around the ns_read_socket_1 call, which merely drains events that are
> > already queued and so returns in microseconds; if it is still running half a
> > second later, something has gone wrong and another event costs nothing.
> > ns_select's much longer [NSApp run] waits are deliberately left alone, so idle
> > Emacs is not woken up any more often than before.
> >
> > Diagnosed on macOS 26.5.1 with Emacs 30.2 (emacs-plus@30) by sampling and then
> > attaching lldb to the hung process: main thread parked in
> > ns_flush_display -> ns_read_socket_1 -> [NSApp run] -> _DPSNextEvent, all other
> > threads idle, send_appdefined == NO, timed_entry == NULL, and the event queue
> > empty for every mask.
> >
> > --- a/src/nsterm.m
> > +++ b/src/nsterm.m
> > @@ -4804,12 +4804,41 @@
> > }
> > else
> > {
> > + NSTimer *retry;
> > +
> > /* Run and wait for events. We must always send one NX_APPDEFINED event
> > to ourself, otherwise [NXApp run] will never exit. */
> > send_appdefined = YES;
> > ns_send_appdefined (-1);
> > +
> > + /* That one event is the only thing that ends [NSApp run], and AppKit
> > + does drop it: while key/main status is being handed over -- app
> > + activation, a second frame taking focus, a frame being
> > + miniaturized -- an application-defined event can fail to come
> > + back. By this point `send_appdefined' is NO, so every later
> > + EV_TRAILER re-post is suppressed, and `timed_entry' has just been
> > + invalidated, so no timer can wake the loop either. A single
> > + dropped event therefore hangs Emacs permanently, with its UI
> > + drawn but dead.
> >
> > + Re-post until the loop really exits. This branch only drains
> > + events that are already queued, so it normally returns in
> > + microseconds; if it is still running when the timer fires,
> > + something has gone wrong and another event costs nothing. */
> > + retry = [[NSTimer scheduledTimerWithTimeInterval: 0.5
> > + repeats: YES
> > + block: ^(NSTimer *timer) {
> > + if ([NSApp isRunning])
> > + {
> > + send_appdefined = YES;
> > + ns_send_appdefined (-1);
> > + }
> > + }] retain];
> > +
> > [NSApp run];
> > +
> > + [retry invalidate];
> > + [retry release];
> > }
> >
> > nevents = n_emacs_events_pending;
> >
> > Fix a permanent macOS UI freeze when no window is main.
> >
> > `ns_read_socket_1' enters [NSApp run], which returns only when the
> > application-defined event posted by `ns_send_appdefined' comes back through
> > -[EmacsApp sendEvent:] and triggers [self stop: self].
> >
> > That event is posted with `windowNumber: [[NSApp mainWindow] windowNumber]'.
> > While the frame is miniaturized, or while key/main status is being handed
> > over (app activation, the window tiling menu, a child frame being closed),
> > [NSApp mainWindow] is nil and the window number is 0. AppKit discards such
> > an event, so [NSApp run] never returns and Emacs never gets back to its
> > command loop -- it keeps queueing input it can never process.
> >
> > There is no recovery path: `send_appdefined' has already been cleared, so
> > every later EV_TRAILER re-post is suppressed, and `timed_entry' has just
> > been invalidated, so no timer can wake the loop either. A single dropped
> > event wedges Emacs permanently.
> >
> > Diagnosed on macOS 26.5.1 with Emacs 30.2 by attaching lldb to a hung
> > process: [NSApp isRunning] == YES (so stop: never ran), [NSApp mainWindow]
> > == nil, [NSApp keyWindow] == nil, send_appdefined == NO, timed_entry ==
> > NULL, n_emacs_events_pending == 99 and climbing. Re-running
> > ns_send_appdefined inside the hung process changed nothing; posting a
> > byte-identical event that differed only in carrying a real window number
> > unfroze it instantly.
> >
> > Prefer the main window, then the key window, then any window with a valid
> > number, so the event is always addressed to a window that exists.
> >
> > --- a/src/nsterm.m
> > +++ b/src/nsterm.m
> > @@ -4686,6 +4686,7 @@
> > if (send_appdefined)
> > {
> > NSEvent *nxev;
> > + NSWindow *dest;
> >
> > /* We only need one NX_APPDEFINED event to stop NXApp from running. */
> > send_appdefined = NO;
> > @@ -4697,12 +4698,29 @@
> > [timed_entry release];
> > timed_entry = nil;
> > }
> > +
> > + /* Address the event to a window that actually exists. With no main
> > + window -- miniaturized, or mid handover of key/main status -- the
> > + window number would be 0 and AppKit would silently discard the
> > + event. That is fatal here: send_appdefined has just been cleared
> > + and timed_entry invalidated, so nothing would ever end [NSApp run]
> > + again, and Emacs would hang forever with its UI unresponsive. */
> > + dest = [NSApp mainWindow];
> > + if (dest == nil)
> > + dest = [NSApp keyWindow];
> > + if (dest == nil)
> > + for (NSWindow *cand in [NSApp windows])
> > + if ([cand windowNumber] > 0)
> > + {
> > + dest = cand;
> > + break;
> > + }
> >
> > nxev = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
> > location: NSMakePoint (0, 0)
> > modifierFlags: 0
> > timestamp: 0
> > - windowNumber: [[NSApp mainWindow] windowNumber]
> > + windowNumber: [dest windowNumber]
> > context: [NSApp context]
> > subtype: 0
> > data1: value
>
>
>
>
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.
Received: (at 72496) by debbugs.gnu.org; 16 Aug 2026 04:29:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 16 00:29:47 2026
Received: from localhost ([127.0.0.1]:47041 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wvSVG-0002Pr-OI
for submit <at> debbugs.gnu.org; Sun, 16 Aug 2026 00:29:47 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:52516)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wvSVE-0002PY-3B
for 72496 <at> debbugs.gnu.org; Sun, 16 Aug 2026 00:29:45 -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 1wvSV8-0002Qb-2P; Sun, 16 Aug 2026 00:29:38 -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=+HEGcpCJGdCUWFNNqWIuImatclW786ICkP1V7uhqvBE=; b=YXrXMoKE96AS
wRNioLd0atKH1NS2m76aKDqXHuXOvS4zMTVrTb6hct+ZuTjBp7VTR2oawZbWXlx5h/56HGkXZ78X8
QOcQu6jRMgJUpleVkAgdozya115HGzgg1FWwQ6aeSEIdk+Cur3gXbaF23p2tfuQEbq2FejIlol6xA
zx4QoZ2xPwKTkDgwdj23u9D22y7YRW8GUdUVEs62namlAJ6m6ng8jJ+rmIkSq4bQd3f5+DMg/p7lv
3Xm3IsWVMGkVM1rFdjcFym4aiu8+oi3WjV5lipglTmsYmAJAoeeqibMEIr9hENO+Qi2BAu9L1DKXv
Ke8dwGgUCBAl8eRoAz3+BQ==;
Date: Sun, 16 Aug 2026 07:29:34 +0300
Message-Id: <86wltq6635.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: plug.rifling_5y@HIDDEN
In-Reply-To: <E59EB6B8-A01D-4A40-946F-E6AA1929B6D9@HIDDEN>
(plug.rifling_5y@HIDDEN)
Subject: Re: bug#72496: 31.0.50 macOS: freezes without beach ball
References: <m2ikwd6a8w.fsf@HIDDEN>
<79FC9978-BB6D-4B3B-B4C9-AC94E59D8987@HIDDEN> <86ldane926.fsf@HIDDEN>
<anCyFdt6EHnGVGmz@HIDDEN> <86h5kv7cfm.fsf@HIDDEN>
<aoB9CpacnQyANyft@HIDDEN> <864igv76sf.fsf@HIDDEN>
<E59EB6B8-A01D-4A40-946F-E6AA1929B6D9@HIDDEN>
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 72496
Cc: Alan Third <alan@HIDDEN>, shipmints@HIDDEN, 72496 <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 (-)
[Please always use Reply to All to reply, to keep everyone CC'ed.]
> From: plug.rifling_5y@HIDDEN
> Date: Sat, 15 Aug 2026 20:29:19 +0100
>
>
> Thanks for attention to this issue!
>
> I just also wanted to share a follow up on this from my side:
>
> I have also recently found a different case for the same symptom, and I have made a separate patch for that issue as well. Please see both of these patches attached.
> After these two fixes I no longer experience this Emacs freezing problem on my side.
>
> Thanks a lot!
>
>
> Recover when the appdefined event that ends [NSApp run] is dropped.
>
> Companion to emacs-30-ns-appdefined-windownumber.patch, which makes the event
> carry a window number that exists. That is necessary but not sufficient: a
> freeze reproduced on 2026-08-03 wedged an Emacs built *with* that patch, with
> two visible frames whose window numbers were both valid.
>
> `ns_read_socket_1' posts one application-defined event and then calls
> [NSApp run], which returns only when that event comes back through
> -[EmacsApp sendEvent:]. AppKit can still fail to deliver it while key/main
> status is being handed over -- app activation, a second frame taking focus, a
> frame being miniaturized. In the observed hang the last thing logged before
> the stall was a focus change, and afterwards [NSApp mainWindow] and
> [NSApp keyWindow] were both nil and stayed nil: even activating the app and
> calling makeKeyAndOrderFront: left AppKit refusing to give either window key
> status, and -[EmacsApp sendEvent:] was never reached again.
>
> What makes that fatal is the missing recovery path, not the drop itself. By
> the time the event is posted `send_appdefined' is already NO, so every later
> EV_TRAILER re-post is suppressed, and `timed_entry' has just been invalidated,
> so no timer can wake the loop. One dropped event hangs Emacs forever: the UI
> keeps redrawing but never accepts input again, and only Force Quit ends it.
>
> So keep re-posting until [NSApp run] actually exits. The timer is scheduled
> only around the ns_read_socket_1 call, which merely drains events that are
> already queued and so returns in microseconds; if it is still running half a
> second later, something has gone wrong and another event costs nothing.
> ns_select's much longer [NSApp run] waits are deliberately left alone, so idle
> Emacs is not woken up any more often than before.
>
> Diagnosed on macOS 26.5.1 with Emacs 30.2 (emacs-plus@30) by sampling and then
> attaching lldb to the hung process: main thread parked in
> ns_flush_display -> ns_read_socket_1 -> [NSApp run] -> _DPSNextEvent, all other
> threads idle, send_appdefined == NO, timed_entry == NULL, and the event queue
> empty for every mask.
>
> --- a/src/nsterm.m
> +++ b/src/nsterm.m
> @@ -4804,12 +4804,41 @@
> }
> else
> {
> + NSTimer *retry;
> +
> /* Run and wait for events. We must always send one NX_APPDEFINED event
> to ourself, otherwise [NXApp run] will never exit. */
> send_appdefined = YES;
> ns_send_appdefined (-1);
> +
> + /* That one event is the only thing that ends [NSApp run], and AppKit
> + does drop it: while key/main status is being handed over -- app
> + activation, a second frame taking focus, a frame being
> + miniaturized -- an application-defined event can fail to come
> + back. By this point `send_appdefined' is NO, so every later
> + EV_TRAILER re-post is suppressed, and `timed_entry' has just been
> + invalidated, so no timer can wake the loop either. A single
> + dropped event therefore hangs Emacs permanently, with its UI
> + drawn but dead.
>
> + Re-post until the loop really exits. This branch only drains
> + events that are already queued, so it normally returns in
> + microseconds; if it is still running when the timer fires,
> + something has gone wrong and another event costs nothing. */
> + retry = [[NSTimer scheduledTimerWithTimeInterval: 0.5
> + repeats: YES
> + block: ^(NSTimer *timer) {
> + if ([NSApp isRunning])
> + {
> + send_appdefined = YES;
> + ns_send_appdefined (-1);
> + }
> + }] retain];
> +
> [NSApp run];
> +
> + [retry invalidate];
> + [retry release];
> }
>
> nevents = n_emacs_events_pending;
>
> Fix a permanent macOS UI freeze when no window is main.
>
> `ns_read_socket_1' enters [NSApp run], which returns only when the
> application-defined event posted by `ns_send_appdefined' comes back through
> -[EmacsApp sendEvent:] and triggers [self stop: self].
>
> That event is posted with `windowNumber: [[NSApp mainWindow] windowNumber]'.
> While the frame is miniaturized, or while key/main status is being handed
> over (app activation, the window tiling menu, a child frame being closed),
> [NSApp mainWindow] is nil and the window number is 0. AppKit discards such
> an event, so [NSApp run] never returns and Emacs never gets back to its
> command loop -- it keeps queueing input it can never process.
>
> There is no recovery path: `send_appdefined' has already been cleared, so
> every later EV_TRAILER re-post is suppressed, and `timed_entry' has just
> been invalidated, so no timer can wake the loop either. A single dropped
> event wedges Emacs permanently.
>
> Diagnosed on macOS 26.5.1 with Emacs 30.2 by attaching lldb to a hung
> process: [NSApp isRunning] == YES (so stop: never ran), [NSApp mainWindow]
> == nil, [NSApp keyWindow] == nil, send_appdefined == NO, timed_entry ==
> NULL, n_emacs_events_pending == 99 and climbing. Re-running
> ns_send_appdefined inside the hung process changed nothing; posting a
> byte-identical event that differed only in carrying a real window number
> unfroze it instantly.
>
> Prefer the main window, then the key window, then any window with a valid
> number, so the event is always addressed to a window that exists.
>
> --- a/src/nsterm.m
> +++ b/src/nsterm.m
> @@ -4686,6 +4686,7 @@
> if (send_appdefined)
> {
> NSEvent *nxev;
> + NSWindow *dest;
>
> /* We only need one NX_APPDEFINED event to stop NXApp from running. */
> send_appdefined = NO;
> @@ -4697,12 +4698,29 @@
> [timed_entry release];
> timed_entry = nil;
> }
> +
> + /* Address the event to a window that actually exists. With no main
> + window -- miniaturized, or mid handover of key/main status -- the
> + window number would be 0 and AppKit would silently discard the
> + event. That is fatal here: send_appdefined has just been cleared
> + and timed_entry invalidated, so nothing would ever end [NSApp run]
> + again, and Emacs would hang forever with its UI unresponsive. */
> + dest = [NSApp mainWindow];
> + if (dest == nil)
> + dest = [NSApp keyWindow];
> + if (dest == nil)
> + for (NSWindow *cand in [NSApp windows])
> + if ([cand windowNumber] > 0)
> + {
> + dest = cand;
> + break;
> + }
>
> nxev = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
> location: NSMakePoint (0, 0)
> modifierFlags: 0
> timestamp: 0
> - windowNumber: [[NSApp mainWindow] windowNumber]
> + windowNumber: [dest windowNumber]
> context: [NSApp context]
> subtype: 0
> data1: value
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.Received: (at 72496) by debbugs.gnu.org; 15 Aug 2026 15:17:02 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 15 11:17:02 2026 Received: from localhost ([127.0.0.1]:42037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wvG85-00048m-IX for submit <at> debbugs.gnu.org; Sat, 15 Aug 2026 11:17:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58650) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wvG81-00047n-N8 for 72496 <at> debbugs.gnu.org; Sat, 15 Aug 2026 11:17:00 -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 1wvG7v-0004nT-LE; Sat, 15 Aug 2026 11:16:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=C28i+x+IDGcy1jJnrofoIC5GRFupseT4x/ZLeUQYlaw=; b=Zq2hog4lKzae/SSCqaBC MQNRrQSm54TQs7NeOKUIZVg8NR/lnD/NTxwEDMxis+XiVyWkbx+mU4AvG5rhNBX0R03qkw6DzoQaT vHSnwl7nxWWcJCsDyn/jnn1ykl97knMpsiAYYR/O47UrKYGyEwZ4lSKCdPwMimakBVMSY9fzrdPQJ Q2ddG4nNPsjSCNNm1GZlJduGII3ZtPIqX8KK83MG+TBMlqphZFHQW1Voc+mDOdh5YdvLx2pceSOBa ydtIzAWqZVVxczoA4+1XWh/syM9sTHJf0llZK1IzE6O3lUtpDBPYl6lm3SKcQWhBGQxhwieJsaW+V 6thnGJbhgRrs7Q==; Date: Sat, 15 Aug 2026 18:16:48 +0300 Message-Id: <864igv76sf.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Alan Third <alan@HIDDEN> In-Reply-To: <aoB9CpacnQyANyft@HIDDEN> (message from Alan Third on Sat, 15 Aug 2026 15:51:54 +0100) Subject: Re: bug#72496: 31.0.50 macOS: freezes without beach ball References: <m2ikwd6a8w.fsf@HIDDEN> <79FC9978-BB6D-4B3B-B4C9-AC94E59D8987@HIDDEN> <86ldane926.fsf@HIDDEN> <anCyFdt6EHnGVGmz@HIDDEN> <86h5kv7cfm.fsf@HIDDEN> <aoB9CpacnQyANyft@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 72496 Cc: plug.rifling_5y@HIDDEN, shipmints@HIDDEN, 72496 <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: Sat, 15 Aug 2026 15:51:54 +0100 > From: Alan Third <alan@HIDDEN> > Cc: plug.rifling_5y@HIDDEN, shipmints@HIDDEN, 72496 <at> debbugs.gnu.org > > On Sat, Aug 15, 2026 at 04:14:53PM +0300, Eli Zaretskii wrote: > > > Date: Mon, 3 Aug 2026 16:21:57 +0100 > > > From: Alan Third <alan@HIDDEN> > > > Cc: plug.rifling_5y@HIDDEN, > > > Stéphane Marks <shipmints@HIDDEN>, > > > 72496 <at> debbugs.gnu.org > > > > > > On Mon, Aug 03, 2026 at 02:29:37PM +0300, Eli Zaretskii wrote: > > > > Alan and Stéphane, any comments or suggestions? > > > > > > This looks good to me. Any "better" alternative would probably involve > > > getting rid of this appdefined event nonsense completely, which isn't > > > easy. > > > > Thanks, Alan. Would you mind installing this on the master branch? I > > cannot compile a macOS build, and I prefer not to install changes I > > cannot verify by building Emacs. > > Do you want me to remove the explanatory text from the commit message? > I think it's the same as the contents of the original email that had > the patch attached. Fine with me. > And it needs the copyright-exemption text too, right? Yes.
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.Received: (at 72496) by debbugs.gnu.org; 15 Aug 2026 14:52:05 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 15 10:52:05 2026 Received: from localhost ([127.0.0.1]:41954 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wvFjw-0000pB-KS for submit <at> debbugs.gnu.org; Sat, 15 Aug 2026 10:52:05 -0400 Received: from dane.soverin.net ([185.233.34.158]:48561) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <alan@HIDDEN>) id 1wvFjt-0000o9-RK for 72496 <at> debbugs.gnu.org; Sat, 15 Aug 2026 10:52:02 -0400 Received: from smtp.soverin.net (unknown [10.10.4.99]) (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 4hMhrW2cKQz2w; Sat, 15 Aug 2026 14:51:55 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.99]) by soverin.net (Postfix) with ESMTPSA id 4hMhrV6gdHzJV; Sat, 15 Aug 2026 14:51:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1786805515; bh=4lHMbvJmnPpwAYIMcA0cXfUcOGhuHPR0u6Q1aC+nnsI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=O+wcSKaR35qSvDhbxA2qF/MXJXTgd4gFOS6Vw7vYAllVymu+rAP+TieusYxW84xyS GOgqebC5wT0MsLk+lwL/T+hOEYo15A9RMYDOa5GWdnTZMeIS4GNxYYvUhA18eKgJe+ jPZiKBQFrP8AfASALB4BYUS6O5Ty42exgVffy8M938VZNaPi12REwiH5XVdKL3Xbtk 9A7K07F07MrVRL4E6foblfUv1lH3DSTOsrEezn9BnLx0WVCSBxAl/7d158b7SWnH6c z0uh6xtPL6Yxm6iflD+L9SVmg8WkAvuM6NA64OIBD4OMndKONhqzV7Mz27Ys45P7yk wZxMMKSl1M9pQ== X-CM-Envelope: MS4xfHuOs6FHjFafzdaWSpkQ1/FojJy3+cX6VAmHC660v06q58PV9zX9wbvMopPEqBoubPYC0Xi0Pczdv9/E1VVcwxyWvDDKpa6k9c8ezqAluaQ2MsCQOqDZ aLcy8uBD2iLXrVIqJERAe+deZXhaOuX5LoroH2Drdu1yxkRqelITl0yIcuY7IOFQl52/Uskcx7S5RdZHRsLX9hWrV1eCV0u7n32w6fraepE2x0l8BSTZiURr Hf+BjBFNPpCP95ODOCjUxgqpf2zAImYkuXKhK45ZadkuFS7rJTOWVq5ZLsLq3TRNKvBB32XBfh56zaFf4jz7pg== X-Soverin-Id: 01a005e8-72f8-7bd5-8e6c-b4955492e7af Received: from localhost (namib [local]) by namib (OpenSMTPD) with ESMTPA id 87a92ab0; Sat, 15 Aug 2026 14:51:54 +0000 (UTC) Date: Sat, 15 Aug 2026 15:51:54 +0100 From: Alan Third <alan@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#72496: 31.0.50 macOS: freezes without beach ball Message-ID: <aoB9CpacnQyANyft@HIDDEN> Mail-Followup-To: Alan Third <alan@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>, plug.rifling_5y@HIDDEN, shipmints@HIDDEN, 72496 <at> debbugs.gnu.org References: <m2ikwd6a8w.fsf@HIDDEN> <79FC9978-BB6D-4B3B-B4C9-AC94E59D8987@HIDDEN> <86ldane926.fsf@HIDDEN> <anCyFdt6EHnGVGmz@HIDDEN> <86h5kv7cfm.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <86h5kv7cfm.fsf@HIDDEN> X-Spampanel-Class: ham X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 72496 Cc: plug.rifling_5y@HIDDEN, shipmints@HIDDEN, 72496 <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 Sat, Aug 15, 2026 at 04:14:53PM +0300, Eli Zaretskii wrote: > > Date: Mon, 3 Aug 2026 16:21:57 +0100 > > From: Alan Third <alan@HIDDEN> > > Cc: plug.rifling_5y@HIDDEN, > > Stéphane Marks <shipmints@HIDDEN>, > > 72496 <at> debbugs.gnu.org > > > > On Mon, Aug 03, 2026 at 02:29:37PM +0300, Eli Zaretskii wrote: > > > Alan and Stéphane, any comments or suggestions? > > > > This looks good to me. Any "better" alternative would probably involve > > getting rid of this appdefined event nonsense completely, which isn't > > easy. > > Thanks, Alan. Would you mind installing this on the master branch? I > cannot compile a macOS build, and I prefer not to install changes I > cannot verify by building Emacs. Do you want me to remove the explanatory text from the commit message? I think it's the same as the contents of the original email that had the patch attached. (I'm not sure what the etiquette is.) And it needs the copyright-exemption text too, right? -- Alan Third
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.Received: (at 72496) by debbugs.gnu.org; 15 Aug 2026 13:15:08 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 15 09:15:08 2026 Received: from localhost ([127.0.0.1]:40519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wvEE7-0006Ow-OG for submit <at> debbugs.gnu.org; Sat, 15 Aug 2026 09:15:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54894) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wvEE4-0006O4-HT for 72496 <at> debbugs.gnu.org; Sat, 15 Aug 2026 09:15:05 -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 1wvEDx-00031z-FZ; Sat, 15 Aug 2026 09:14:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=3JipXA39hj7YxrElJL5hrGWseSnCFd+HrxejU1MPtWw=; b=nRDOgMwMPv8C6ExkhOEE ZM4KjvJzRt2DD5ZapFOv2o6DWP/nlhxh0mJGiBwLDjpWhZLUZrbTx2Uq2fYyTPAwzby9qT+ON4Sme usBdtoDJnxZ0Tpr3zLKNYiBHBRFgjiTfLutUx7Nck17LULLodDXfdi4kfdJs64Nq6jt2q7vLAo7Tr SYZDUuO7Hrasg5NGtuGPGEwDJILOI5CIgZTViaA0zRlMeZAEpY2/LtcH4WB5qx4qWR9zjskaKLOBi VfgKdq5d9QvbXlcKXuUWnFcX5PcoqK45pvx3ffUBiMY9D2Dy6JyStpxr1Wg7ghDu6KESmrt/ZZaAy HQqPhJXbVoIm/g==; Date: Sat, 15 Aug 2026 16:14:53 +0300 Message-Id: <86h5kv7cfm.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Alan Third <alan@HIDDEN> In-Reply-To: <anCyFdt6EHnGVGmz@HIDDEN> (message from Alan Third on Mon, 3 Aug 2026 16:21:57 +0100) Subject: Re: bug#72496: 31.0.50 macOS: freezes without beach ball References: <m2ikwd6a8w.fsf@HIDDEN> <79FC9978-BB6D-4B3B-B4C9-AC94E59D8987@HIDDEN> <86ldane926.fsf@HIDDEN> <anCyFdt6EHnGVGmz@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 72496 Cc: plug.rifling_5y@HIDDEN, shipmints@HIDDEN, 72496 <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: Mon, 3 Aug 2026 16:21:57 +0100 > From: Alan Third <alan@HIDDEN> > Cc: plug.rifling_5y@HIDDEN, > Stéphane Marks <shipmints@HIDDEN>, > 72496 <at> debbugs.gnu.org > > On Mon, Aug 03, 2026 at 02:29:37PM +0300, Eli Zaretskii wrote: > > Alan and Stéphane, any comments or suggestions? > > This looks good to me. Any "better" alternative would probably involve > getting rid of this appdefined event nonsense completely, which isn't > easy. Thanks, Alan. Would you mind installing this on the master branch? I cannot compile a macOS build, and I prefer not to install changes I cannot verify by building Emacs. TIA
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.
Received: (at 72496) by debbugs.gnu.org; 3 Aug 2026 15:25:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 03 11:25:20 2026
Received: from localhost ([127.0.0.1]:57101 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wquXX-0004HO-Tr
for submit <at> debbugs.gnu.org; Mon, 03 Aug 2026 11:25:20 -0400
Received: from mail-ua1-x934.google.com ([2607:f8b0:4864:20::934]:42293)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
id 1wquXV-0004H0-Go
for 72496 <at> debbugs.gnu.org; Mon, 03 Aug 2026 11:25:18 -0400
Received: by mail-ua1-x934.google.com with SMTP id
a1e0cc1a2514c-977ba4d3b49so2573236241.1
for <72496 <at> debbugs.gnu.org>; Mon, 03 Aug 2026 08:25:17 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1785770712; cv=none;
d=google.com; s=arc-20260327;
b=NUMhOWuiyF6v5pm8crOmVYoHin9f2giJfAEKegPfAQjrciIXTt7jycuhs8jvMbu8e+
m2QOBKiFPvFHW2XIwMtrrlBagyMwVrybKHxMNiZnjD1leGH3j8RneluwSky/p8D++iXS
tqh/ntLZ8Bu7G6Dgtwv9EfACQTx+5d70p0mQSgXSJM8dVh8fXFwuf4W7qO3LDdqmLc2D
BdDbWqZpQ1/s3on7gcswJwwTaO7GSnQ4UUWx+tj8LrFh9y5/RqCE6VFSJ098yRdWmdG4
HhKUZ0gQHJfFmRgOdqRQYhdUer9toyIXcpBjNsgjHypUdeMsd26z1StpSopyeOl46Qtd
fHwQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20260327;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:dkim-signature;
bh=kh0M8CVUqLpEEUXWd+1L0bNXFy42LlwoKxfUev9tp+o=;
fh=UIqV0aStl9n7b35VPuA+Nelh4GWh8TgIQzcqvXS2PCE=;
b=FT4qUWxNYm26qyvbO+XeHXjr4L20Q5J6GxepZ+c0/Mz83B4JMG5qozdPUpmFiwV4HM
286G8Gh6dFtJ1FcjOZLsDIti2MSql2ct1alYvY2WGK+/CmZcNH1FYCUmu0wu0G6+0BWQ
AwYgX/qBgEjpd9s3tDPl/djew1Yfz04wxB2+fY81BlUve26hYVM/0Xvl1UZthPgHXMk0
PB9jIvqOp7pTohR5VCVlvjZwWNmJcAdsSx5cGvKtdD/jZFcC9TRSYhxCV1/XyNizMydv
JIKgPYpScA1qR7nP3OsNvMMadne7PxyVH699so9e60ULysGIonK4xXpOdLXdE39Atnyb
Wxng==; 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=1785770712; x=1786375512; darn=debbugs.gnu.org;
h=content-type:to:subject:message-id:date:from:in-reply-to:references
:mime-version:from:to:cc:subject:date:message-id:reply-to
:content-type; bh=kh0M8CVUqLpEEUXWd+1L0bNXFy42LlwoKxfUev9tp+o=;
b=kdPcdY6zY8WYHXqagq/MZ1iiIWIZpuhr8GkOMMXo59DANxosyh7kFNyg52I7lHOJZU
2HoX6NWWn5xxbvct2kMuri0X5wYq8nsgJmotWUpBpouZAIkPDSJ0cymMUsgGhBQGRqak
Jz401MJtIen+bYbnNtSvCg4nSdmxykII6TEToxh3lJvYzWtsHj0Pn5X4OxJD7q/lM9ma
MflrQeDjYOtlqhWYuLz7DPvKjuDM/wAqUVJvEarKff0XHt5XIdzxsMrn52KXh1oo/lbv
26I3epGMiAPMjz/eUfD1MQm1TVjQjAJx2nEq1EtGTPXDTxjl2H+ODcrTSxzgGm8KPA6N
uIqw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1785770712; x=1786375512;
h=content-type: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=kh0M8CVUqLpEEUXWd+1L0bNXFy42LlwoKxfUev9tp+o=;
b=gZ0v+MyquU3GVTysbuljc3N/u2Y1VajbyJHSsirrmQsls5xS5rYebEtJyP3IJQDQvQ
Kgd+OhTXtz9zuNAqrAQWmh0uMVQ97OWJsFRNZLZgjLhqOTNK664g93XlZly/nqpwTTEm
Myvsjes8mkoNSrEpzp24r23eZOFHwPFfYa9SUo7xR9qRtUBrVc4sVUttSCn4TBKbV44d
UZt0N0d7YO12yo8qRLyGz8tos5eYOD6jyu6Gy88rDt2dodepU273n2Xic2c5bLQmFhLL
xC2sX7iGdWHIVXn72AIszQ4NJYVZ8HFK2mfMcMyGDGZNepiHwiqKoXThztEcUZl+Hmfe
H7Yg==
X-Forwarded-Encrypted: i=1;
AHgh+Rq3YKMqjw97CuD3HAlNFnHd85cPXg/QwsuY9xh1XpSoo2ZoI2Yt1KY67eJDsvFq3oEFRG0dCQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzdYQPLLcTVeSZ0sDGF9ps1oFR2o6NQjkMRIeoa92o0XB0IGVYV
0Obrzy0KqMpWp6azNQcHzTrmwFgvY0+j6TT7MxaUlLh3hPYx3gYXPzBSRS7zMSO/eTvikB3chlM
zdFt0nZ7W5tj+tzFQVDVgACrTPypKCMc=
X-Gm-Gg: AR+sD1060thzcxRDSa/pvmELYL1zgWIAl0zcdvbH6UpvBGxbYdVgBnAov/awvRmZbCZ
K3HGzaiyBF2/tNnqLfu09fakHduBLeiJMBZWxNU8eJ1D/o5Rwa5XKj0ZUyWWA4j/Mq0IpWd5A+u
Jh7uGJENjYn7UGLUTT9WIBgzBKvR/MciB4PxsmrNQeualZSgZ8+yUyRK2cymNrT/DUg+EFZn8zb
yTGG8dI3DmnjQWIaRLl160CZIs8pNNt1IiImME/zpSSccRIcB+Nsoh0Djn0TLjA2+c7lIH2JMdj
RjAnNZF5pX/PhjmbCTAfrJYretEOus6XEx+SnUTTZkVnJu5QHtcqI13caNHnxo+qq6eH+12GUou
dGHqJuKSmdwpMgeOViL8FYrH6jPAH+JwKYNwxhj/La35clvPASsOknNvolaQHeTdAYfowjS2A0l
eolZWzYKe8gAL7hf5syNCqA5BUKKFGc7zLCQ0k0kd57QxogzHqph6+eT/+RIovNvy2u3k=
X-Received: by 2002:a05:6102:7ad:b0:738:f27:43fc with SMTP id
ada2fe7eead31-758f8869b41mr3015309137.2.1785770711621; Mon, 03 Aug 2026
08:25:11 -0700 (PDT)
MIME-Version: 1.0
References: <m2ikwd6a8w.fsf@HIDDEN>
<79FC9978-BB6D-4B3B-B4C9-AC94E59D8987@HIDDEN>
<86ldane926.fsf@HIDDEN> <anCyFdt6EHnGVGmz@HIDDEN>
In-Reply-To: <anCyFdt6EHnGVGmz@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Mon, 3 Aug 2026 17:25:00 +0200
X-Gm-Features: AUfX_mwp1emp4wevtL3OoUZRMYvr1c8QrPTNvxOy0qt0Y_YcQYbKsq8ogeQ-Qg8
Message-ID: <CAN+1Hbo+ZnU1HW1vPbmweeBV5oXNtvZSYKJj1khn-9doLCx7Sg@HIDDEN>
Subject: Re: bug#72496: 31.0.50 macOS: freezes without beach ball
To: Alan Third <alan@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
plug.rifling_5y@HIDDEN,
=?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>, 72496 <at> debbugs.gnu.org
Content-Type: multipart/alternative; boundary="000000000000eaa5ab0658262425"
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 72496
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 (/)
--000000000000eaa5ab0658262425
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Mon, Aug 3, 2026 at 11:21=E2=80=AFAM Alan Third <alan@HIDDEN> wrote:
> On Mon, Aug 03, 2026 at 02:29:37PM +0300, Eli Zaretskii wrote:
> > Alan and St=C3=A9phane, any comments or suggestions?
>
> This looks good to me. Any "better" alternative would probably involve
> getting rid of this appdefined event nonsense completely, which isn't
> easy.
>
> > > From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 200=
1
> > > From: Anton Dergunov <adergunov.login@HIDDEN>
> > > Subject: [PATCH] Fix a permanent hang on macOS when no window is main
> > >
> > > 'ns_send_appdefined' posted the event that ends [NSApp run] with
> > > windowNumber: [[NSApp mainWindow] windowNumber]. While the frame is
> > > miniaturized, or while key/main status is being handed over, [NSApp
> > > mainWindow] is nil and the window number is 0; AppKit discards such a=
n
> > > event, so [NSApp run] never returns and Emacs never gets back to its
> > > command loop.
> > >
> > > The hang is permanent rather than intermittent because nothing retrie=
s:
> > > 'send_appdefined' has already been cleared by this same call, so ever=
y
> > > later EV_TRAILER re-post is suppressed, and 'timed_entry' has just be=
en
> > > invalidated. Unlike 'ns_select_1', 'ns_read_socket_1' never arms a
> > > 'timed_entry', so no timer can wake the loop either.
> > >
> > > Note that [NSApp keyWindow] is nil while miniaturized too, so the sca=
n
> > > over [NSApp windows] is the fallback that actually applies.
> > >
> > > * src/nsterm.m (ns_send_appdefined): Address the app-defined event to=
a
> > > window that exists. (Bug#72496)
> > > ---
> > > --- a/src/nsterm.m
> > > +++ b/src/nsterm.m
> > > @@ -4686,6 +4686,7 @@
> > > if (send_appdefined)
> > > {
> > > NSEvent *nxev;
> > > + NSWindow *dest;
> > >
> > > /* We only need one NX_APPDEFINED event to stop NXApp from
> running. */
> > > send_appdefined =3D NO;
> > > @@ -4697,12 +4698,29 @@
> > > [timed_entry release];
> > > timed_entry =3D nil;
> > > }
> > > +
> > > + /* Address the event to a window that actually exists. With n=
o
> main
> > > + window -- miniaturized, or mid handover of key/main status
> -- the
> > > + window number would be 0 and AppKit would silently discard
> the
> > > + event. That is fatal here: send_appdefined has just been
> cleared
> > > + and timed_entry invalidated, so nothing would ever end
> [NSApp run]
> > > + again, and Emacs would hang forever with its UI
> unresponsive. */
> > > + dest =3D [NSApp mainWindow];
> > > + if (dest =3D=3D nil)
> > > + dest =3D [NSApp keyWindow];
> > > + if (dest =3D=3D nil)
> > > + for (NSWindow *cand in [NSApp windows])
> > > + if ([cand windowNumber] > 0)
> > > + {
> > > + dest =3D cand;
> > > + break;
> > > + }
> > >
> > > nxev =3D [NSEvent otherEventWithType:
> NSEventTypeApplicationDefined
> > > location: NSMakePoint (0, 0)
> > > modifierFlags: 0
> > > timestamp: 0
> > > - windowNumber: [[NSApp mainWindow]
> windowNumber]
> > > + windowNumber: [dest windowNumber]
> > > context: [NSApp context]
> > > subtype: 0
> > > data1: value
>
The patch itself can use some stylistic improvements. That aside, perhaps
we should create a global invisible canary window and avoid guesswork and
any potential to drop messages should there be no windows available at the
time of this call.
--000000000000eaa5ab0658262425
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 Mon, Aug 3, 2026 at 11:21=E2=80=AFAM Alan T=
hird <<a href=3D"mailto:alan@HIDDEN">alan@HIDDEN</a>> wrote:<=
/span></div></div><div class=3D"gmail_quote gmail_quote_container"><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px=
solid rgb(204,204,204);padding-left:1ex">On Mon, Aug 03, 2026 at 02:29:37P=
M +0300, Eli Zaretskii wrote:<br>
> Alan and St=C3=A9phane, any comments or suggestions?<br>
<br>
This looks good to me. Any "better" alternative would probably in=
volve<br>
getting rid of this appdefined event nonsense completely, which isn't<b=
r>
easy.<br>
<br>
> > From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00=
2001<br>
> > From: Anton Dergunov <<a href=3D"mailto:adergunov.login@gmail.=
com" target=3D"_blank">adergunov.login@HIDDEN</a>><br>
> > Subject: [PATCH] Fix a permanent hang on macOS when no window is =
main<br>
> > <br>
> > 'ns_send_appdefined' posted the event that ends [NSApp ru=
n] with<br>
> > windowNumber: [[NSApp mainWindow] windowNumber].=C2=A0 While the =
frame is<br>
> > miniaturized, or while key/main status is being handed over, [NSA=
pp<br>
> > mainWindow] is nil and the window number is 0; AppKit discards su=
ch an<br>
> > event, so [NSApp run] never returns and Emacs never gets back to =
its<br>
> > command loop.<br>
> > <br>
> > The hang is permanent rather than intermittent because nothing re=
tries:<br>
> > 'send_appdefined' has already been cleared by this same c=
all, so every<br>
> > later EV_TRAILER re-post is suppressed, and 'timed_entry'=
has just been<br>
> > invalidated.=C2=A0 Unlike 'ns_select_1', 'ns_read_soc=
ket_1' never arms a<br>
> > 'timed_entry', so no timer can wake the loop either.<br>
> > <br>
> > Note that [NSApp keyWindow] is nil while miniaturized too, so the=
scan<br>
> > over [NSApp windows] is the fallback that actually applies.<br>
> > <br>
> > * src/nsterm.m (ns_send_appdefined): Address the app-defined even=
t to a<br>
> > window that exists.=C2=A0 (Bug#72496)<br>
> > ---<br>
> > --- a/src/nsterm.m<br>
> > +++ b/src/nsterm.m<br>
> > @@ -4686,6 +4686,7 @@<br>
> >=C2=A0 =C2=A0 if (send_appdefined)<br>
> >=C2=A0 =C2=A0 =C2=A0 {<br>
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 NSEvent *nxev;<br>
> > +=C2=A0 =C2=A0 =C2=A0 NSWindow *dest;<br>
> >=C2=A0 <br>
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* We only need one NX_APPDEFINED even=
t to stop NXApp from running.=C2=A0 */<br>
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 send_appdefined =3D NO;<br>
> > @@ -4697,12 +4698,29 @@<br>
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [timed_entry release];<b=
r>
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 timed_entry =3D nil;<br>
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
> > +<br>
> > +=C2=A0 =C2=A0 =C2=A0 /* Address the event to a window that actua=
lly exists.=C2=A0 With no main<br>
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0window -- miniaturized, or mid=
handover of key/main status -- the<br>
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0window number would be 0 and A=
ppKit would silently discard the<br>
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0event.=C2=A0 That is fatal her=
e: send_appdefined has just been cleared<br>
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0and timed_entry invalidated, s=
o nothing would ever end [NSApp run]<br>
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0again, and Emacs would hang fo=
rever with its UI unresponsive.=C2=A0 */<br>
> > +=C2=A0 =C2=A0 =C2=A0 dest =3D [NSApp mainWindow];<br>
> > +=C2=A0 =C2=A0 =C2=A0 if (dest =3D=3D nil)<br>
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 dest =3D [NSApp keyWindow];<br>
> > +=C2=A0 =C2=A0 =C2=A0 if (dest =3D=3D nil)<br>
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 for (NSWindow *cand in [NSApp window=
s])<br>
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ([cand windowNumber] > =
0)<br>
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br>
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 dest =3D cand;<=
br>
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;<br>
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
> >=C2=A0 <br>
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 nxev =3D [NSEvent otherEventWithType: =
NSEventTypeApplicationDefined<br>
> >=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 location: NSMakePoint =
(0, 0)<br>
> >=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=A0modifierFlags: 0<br>
> >=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=A0timestamp: 0<br>
> > -=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 windowNumber: [[NSApp mainWindow] window=
Number]<br>
> > +=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 windowNumber: [dest windowNumber]<br>
> >=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=A0context: [NSApp =
context]<br>
> >=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=A0subtype: 0<br>
> >=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=A0data1: va=
lue<br></blockquote><div><br></div><div class=3D"gmail_default" style=3D"fo=
nt-family:monospace">The patch itself can use some stylistic improvements.=
=C2=A0 That aside, perhaps we should create a global invisible canary windo=
w and avoid guesswork and any potential to drop messages should there be no=
windows available at the time of this call.</div></div></div>
--000000000000eaa5ab0658262425--
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.
Received: (at 72496) by debbugs.gnu.org; 3 Aug 2026 15:22:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 03 11:22:08 2026
Received: from localhost ([127.0.0.1]:57065 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wquUR-0003vV-Ul
for submit <at> debbugs.gnu.org; Mon, 03 Aug 2026 11:22:08 -0400
Received: from dane.soverin.net ([185.233.34.157]:46475)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <alan@HIDDEN>) id 1wquUP-0003uy-Mk
for 72496 <at> debbugs.gnu.org; Mon, 03 Aug 2026 11:22:06 -0400
Received: from smtp.soverin.net (unknown [10.10.4.99])
(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 4hDL4l19wRz3v;
Mon, 03 Aug 2026 15:21:59 +0000 (UTC)
Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.99]) by soverin.net
(Postfix) with ESMTPSA id 4hDL4k4WPbz57q;
Mon, 3 Aug 2026 15:21:58 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin;
t=1785770519; bh=wqYbp5T3Qo8xg4cVaS8R2dTppdCKMvEmrfJje21LRQI=;
h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
b=Ym+E0X/lROb6w4+W5qLEKjl+4azuGlLkRDB3CSdYkU2BHWJIQQaD8mnNzxANVrWrz
FuJKlBlqYmEAkZVRAiHs9G3BCsMz//BTb52JgJRBie8MISVwaE9PF7xt8NCvvv8Ihk
68OJiXqpFqYs1DEjiytRdAu/9EzM+dRwKbrQNgp935HzMDm4tqVu446fnzroRf2rph
gDdjsBKrwLtxUuMyB4PNFTI9asa0hATTyv1/mIafkMtOIOijN9VCC+BLwXyxhfQfAQ
XSTF5obI8Lcsr0Yh4DvkrT19p8UAvrTbw4fy4NrZuc10fwdkv2zIm2vaYMsjvvb+YJ
TPg7BNfnP9tCw==
X-CM-Envelope: MS4xfJDP/NAcRbZmNpmg4S2Tz7pLlP16va1OCoaGjQwd6qdcN3RhUihd30fs+lGLnkEdsUB2JOD6nmqKTULa0d1h2z/+Xz6DfdRtVRAXO/XR2Ku2DE1ip4+0
LzJ1EqXKkHWucOJEsk+XuqX7FaLSHTDNv1XjEhzGVU9Cz4rgMHfVdk0Tfj1yXzt4ehWqVy4vEWMfw2OUPrpFR1jVL9j3uSanA9ycXW2URAKi7P6nPB183mJX
RoU8qxt0Ea530hgLVSFB0ZMCoZXP1zFgdE2cyJuXMFPglpdV4WhXowXocP23h6DQB3uGmdjntWNQnS9nOQwYXQ==
X-Soverin-Id: 019fc837-a5f0-716d-b33f-9429b6e0725f
Received: from localhost (namib [local])
by namib (OpenSMTPD) with ESMTPA id b8fa741b;
Mon, 3 Aug 2026 15:21:57 +0000 (UTC)
Date: Mon, 3 Aug 2026 16:21:57 +0100
From: Alan Third <alan@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#72496: 31.0.50 macOS: freezes without beach ball
Message-ID: <anCyFdt6EHnGVGmz@HIDDEN>
Mail-Followup-To: Alan Third <alan@HIDDEN>,
Eli Zaretskii <eliz@HIDDEN>, plug.rifling_5y@HIDDEN,
=?iso-8859-1?Q?St=E9phane?= Marks <shipmints@HIDDEN>,
72496 <at> debbugs.gnu.org
References: <m2ikwd6a8w.fsf@HIDDEN>
<79FC9978-BB6D-4B3B-B4C9-AC94E59D8987@HIDDEN>
<86ldane926.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <86ldane926.fsf@HIDDEN>
X-Spampanel-Class: ham
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 72496
Cc: plug.rifling_5y@HIDDEN,
=?iso-8859-1?Q?St=E9phane?= Marks <shipmints@HIDDEN>, 72496 <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 Mon, Aug 03, 2026 at 02:29:37PM +0300, Eli Zaretskii wrote:
> Alan and Stéphane, any comments or suggestions?
This looks good to me. Any "better" alternative would probably involve
getting rid of this appdefined event nonsense completely, which isn't
easy.
> > From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
> > From: Anton Dergunov <adergunov.login@HIDDEN>
> > Subject: [PATCH] Fix a permanent hang on macOS when no window is main
> >
> > 'ns_send_appdefined' posted the event that ends [NSApp run] with
> > windowNumber: [[NSApp mainWindow] windowNumber]. While the frame is
> > miniaturized, or while key/main status is being handed over, [NSApp
> > mainWindow] is nil and the window number is 0; AppKit discards such an
> > event, so [NSApp run] never returns and Emacs never gets back to its
> > command loop.
> >
> > The hang is permanent rather than intermittent because nothing retries:
> > 'send_appdefined' has already been cleared by this same call, so every
> > later EV_TRAILER re-post is suppressed, and 'timed_entry' has just been
> > invalidated. Unlike 'ns_select_1', 'ns_read_socket_1' never arms a
> > 'timed_entry', so no timer can wake the loop either.
> >
> > Note that [NSApp keyWindow] is nil while miniaturized too, so the scan
> > over [NSApp windows] is the fallback that actually applies.
> >
> > * src/nsterm.m (ns_send_appdefined): Address the app-defined event to a
> > window that exists. (Bug#72496)
> > ---
> > --- a/src/nsterm.m
> > +++ b/src/nsterm.m
> > @@ -4686,6 +4686,7 @@
> > if (send_appdefined)
> > {
> > NSEvent *nxev;
> > + NSWindow *dest;
> >
> > /* We only need one NX_APPDEFINED event to stop NXApp from running. */
> > send_appdefined = NO;
> > @@ -4697,12 +4698,29 @@
> > [timed_entry release];
> > timed_entry = nil;
> > }
> > +
> > + /* Address the event to a window that actually exists. With no main
> > + window -- miniaturized, or mid handover of key/main status -- the
> > + window number would be 0 and AppKit would silently discard the
> > + event. That is fatal here: send_appdefined has just been cleared
> > + and timed_entry invalidated, so nothing would ever end [NSApp run]
> > + again, and Emacs would hang forever with its UI unresponsive. */
> > + dest = [NSApp mainWindow];
> > + if (dest == nil)
> > + dest = [NSApp keyWindow];
> > + if (dest == nil)
> > + for (NSWindow *cand in [NSApp windows])
> > + if ([cand windowNumber] > 0)
> > + {
> > + dest = cand;
> > + break;
> > + }
> >
> > nxev = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
> > location: NSMakePoint (0, 0)
> > modifierFlags: 0
> > timestamp: 0
> > - windowNumber: [[NSApp mainWindow] windowNumber]
> > + windowNumber: [dest windowNumber]
> > context: [NSApp context]
> > subtype: 0
> > data1: value
--
Alan Third
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.
Received: (at 72496) by debbugs.gnu.org; 3 Aug 2026 11:29:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 03 07:29:51 2026
Received: from localhost ([127.0.0.1]:54582 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wqqre-00048l-Gm
for submit <at> debbugs.gnu.org; Mon, 03 Aug 2026 07:29:51 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:54988)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wqqrc-00048J-5Q
for 72496 <at> debbugs.gnu.org; Mon, 03 Aug 2026 07:29:49 -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 1wqqrV-0000ou-1e; Mon, 03 Aug 2026 07:29:42 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
Date; bh=f7p91t3yC+oP7ybfBgHdSkPoaPIg+fUUSITfi5grFVA=; b=qqwCGpf+bgeGcTCgU+ii
S2gUj9QUXI60wiPkpVne+kdf4zdJOuMRiHk4Mn7/tKZPzdteSfs+e9y1vf5oAY12zZ5KWugP0H55i
mDuBzsi2l5CFnZ1kKIeurGkehKI3CfKyomH+MXkxNeWdX2dvNcspfmjc1wLoIRObm9LkiaZm7ohQW
DtRHzUb6v8d+CCEj1UNzZvZsafsoNSSlMc7MX91a01hkEAzPUA77HilHWqubINZimoYRfZ9W1M9i7
HPkzcIztNgpHMYLOwx2/4wJ2V7bcBRfNjzlbWbhviFp/ZcCR57xeIFFBisTD3rPucZ9jkhArT96lL
kYg+rptOKNIkng==;
Date: Mon, 03 Aug 2026 14:29:37 +0300
Message-Id: <86ldane926.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: plug.rifling_5y@HIDDEN, Alan Third <alan@HIDDEN>,
=?iso-8859-1?Q?St=E9phane?= Marks <shipmints@HIDDEN>
In-Reply-To: <79FC9978-BB6D-4B3B-B4C9-AC94E59D8987@HIDDEN>
(bug-gnu-emacs@HIDDEN)
Subject: Re: bug#72496: 31.0.50 macOS: freezes without beach ball
References: <m2ikwd6a8w.fsf@HIDDEN>
<79FC9978-BB6D-4B3B-B4C9-AC94E59D8987@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 72496
Cc: 72496 <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: Sun, 2 Aug 2026 15:39:41 +0100
> From: plug.rifling_5y--- via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>
> I think I have found why the app-defined events get lost, and it can be
> reproduced on demand.
>
> 'ns_send_appdefined' poststhe event with
>
> windowNumber: [[NSApp mainWindow] windowNumber]
>
> While the frame is miniaturized -- or while key/main status is being handed
> over -- [NSApp mainWindow] is nil, so that argument is 0. AppKit discards
> the event, and [NSApp run] never returns.
>
> That explains why it is permanent rather than intermittent. Nothing
> retries: 'send_appdefined' has already been set to NO by the same call, so
> every later EV_TRAILER re-post is suppressed, and 'timed_entry' has just
> been invalidated. 'ns_read_socket_1', unlike 'ns_select_1', never arms a
> 'timed_entry', so no timer can wake the loop either. A single lost event
> wedges Emacs for good.
>
> Evidence from a live hung process
> ---------------------------------
>
> macOS 26.5.1, Emacs 30.2, built from source so lldb could attach. Emacs
> had been hung for 59 minutes:
>
> [NSApp isRunning] YES -- so stop: was never called
> [NSApp mainWindow] nil
> [NSApp keyWindow] nil
> send_appdefined NO -- latched; no re-post possible
> timed_entry NULL -- no timer wake-up either
> n_emacs_events_pending 99, and climbing
>
> The stack was:
>
> wait_reading_process_output process.c:5499
> redisplay_preserve_echo_area (13) xdisp.c:17757
> flush_frame
> ns_flush_display
> ns_read_socket_1
> -[EmacsApp run] -> [super run] <- blocked here
>
> n_emacs_events_pending climbing is the telling part: AppKit was delivering
> input normally and Emacs was queueing it. Nothing was blocked or starved.
> The only thing missing was the event that ends [NSApp run].
>
> A/B test on that same hung process
> ----------------------------------
>
> 1. Running Emacs' own code inside the hung process --
> send_appdefined = YES; ns_send_appdefined (-1); -- changed nothing.
> mainWindow was still nil, so the window number was 0 again.
>
> 2. Posting a byte-identical NSEventTypeApplicationDefined event that
> differed only in carrying a real window number unfroze Emacs
> immediately.
>
> The window number is the entire difference.
>
> Reproducer
> ----------
>
> Miniaturizing makes both mainWindow and keyWindow nil, deterministically.
> Any subprocess status change then goes status_notify ->
> redisplay_preserve_echo_area (13) -> flush_frame -> ns_flush_display ->
> ns_read_socket_1. So:
>
> (run-at-time 3 3 (lambda () (start-process "probe" nil "sleep" "1")))
>
> then miniaturize the frame and wait. Emacs is dead, and deminiaturizing
> does not bring it back.
>
> This also matches the reports of freezes on app activation and on the green
> zoom button's tiling menu: those take main/key status away too.
>
> Verification of the patch
> -------------------------
>
> With the patch applied, in the same miniaturized state ([NSApp mainWindow]
> == nil), a breakpoint on -[NSApplication postEvent:atStart:] shows:
>
> type = 15 (NSEventTypeApplicationDefined)
> windowNumber = 3516
> data1 = -1
>
> and 80 seconds of the reproducer above, with about 27 subprocess exits,
> produced no freeze.
>
> Note that keyWindow is nil while miniaturized as well, so it is the scan
> over [NSApp windows] that actually does the work here; a fallback that only
> tried keyWindow would not fix anything.
>
> The patch is against master (the function is unchanged from Emacs 30.2, and
> it applies to both).
>
> I have not signed FSF copyright papers. The change is about 12 lines of
> code plus a comment; I am happy to shorten it, or for someone to rewrite it
> on the strength of the diagnosis alone if that is easier.
Alan and Stéphane, any comments or suggestions?
> From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
> From: Anton Dergunov <adergunov.login@HIDDEN>
> Subject: [PATCH] Fix a permanent hang on macOS when no window is main
>
> 'ns_send_appdefined' posted the event that ends [NSApp run] with
> windowNumber: [[NSApp mainWindow] windowNumber]. While the frame is
> miniaturized, or while key/main status is being handed over, [NSApp
> mainWindow] is nil and the window number is 0; AppKit discards such an
> event, so [NSApp run] never returns and Emacs never gets back to its
> command loop.
>
> The hang is permanent rather than intermittent because nothing retries:
> 'send_appdefined' has already been cleared by this same call, so every
> later EV_TRAILER re-post is suppressed, and 'timed_entry' has just been
> invalidated. Unlike 'ns_select_1', 'ns_read_socket_1' never arms a
> 'timed_entry', so no timer can wake the loop either.
>
> Note that [NSApp keyWindow] is nil while miniaturized too, so the scan
> over [NSApp windows] is the fallback that actually applies.
>
> * src/nsterm.m (ns_send_appdefined): Address the app-defined event to a
> window that exists. (Bug#72496)
> ---
> --- a/src/nsterm.m
> +++ b/src/nsterm.m
> @@ -4686,6 +4686,7 @@
> if (send_appdefined)
> {
> NSEvent *nxev;
> + NSWindow *dest;
>
> /* We only need one NX_APPDEFINED event to stop NXApp from running. */
> send_appdefined = NO;
> @@ -4697,12 +4698,29 @@
> [timed_entry release];
> timed_entry = nil;
> }
> +
> + /* Address the event to a window that actually exists. With no main
> + window -- miniaturized, or mid handover of key/main status -- the
> + window number would be 0 and AppKit would silently discard the
> + event. That is fatal here: send_appdefined has just been cleared
> + and timed_entry invalidated, so nothing would ever end [NSApp run]
> + again, and Emacs would hang forever with its UI unresponsive. */
> + dest = [NSApp mainWindow];
> + if (dest == nil)
> + dest = [NSApp keyWindow];
> + if (dest == nil)
> + for (NSWindow *cand in [NSApp windows])
> + if ([cand windowNumber] > 0)
> + {
> + dest = cand;
> + break;
> + }
>
> nxev = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
> location: NSMakePoint (0, 0)
> modifierFlags: 0
> timestamp: 0
> - windowNumber: [[NSApp mainWindow] windowNumber]
> + windowNumber: [dest windowNumber]
> context: [NSApp context]
> subtype: 0
> data1: value
> --
> 2.39.5
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.
Received: (at 72496) by debbugs.gnu.org; 3 Aug 2026 04:42:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 03 00:42:38 2026
Received: from localhost ([127.0.0.1]:51534 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wqkVZ-0002BT-R0
for submit <at> debbugs.gnu.org; Mon, 03 Aug 2026 00:42:38 -0400
Received: from mr-2002d-snip6-11.eps.apple.com ([2a01:b747:3000:201::35]:38892
helo=outbound.mr.icloud.com)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <plug.rifling_5y@HIDDEN>)
id 1wqXMH-0007N3-Gl
for 72496 <at> debbugs.gnu.org; Sun, 02 Aug 2026 10:40:10 -0400
Received: from outbound.mr.icloud.com (unknown [127.0.0.2])
by p00-icloudmta-asmtp-us-west-2a-20-percent-0 (Postfix) with ESMTPS id
049061800189
for <72496 <at> debbugs.gnu.org>; Sun, 02 Aug 2026 14:39:59 +0000 (UTC)
X-ICL-RepId: 019fc2ea-ddcb-730b-b647-63b585ef4f3f
X-ICL-Out-Info: HUtFAUMEWwJACUgATUQeDx5WFlZNRAJCTUwWWANYHFxQXBwOHVseVV5LEVUBXgVVLwwBcwRUB10FXVZQAlpLVBQEEVABWB5WXloXXk1FCA9BGRBWAVhWXQVNGlwYWQ8cHUtWWg5bBEcUFxtcABcbRgIEIwJfAEUCXglWATAXD1ZNUBtfAkIPHBNWFRMAXg8PTA5BdS4OUgVIFDpxW3NGBjIKOh4vAygLXXg7CllyXgs0AUELWncCURxWDVdDVARfThkMSh1SVlodXA==
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai;
t=1785681602; x=1788273602; bh=JrxD9PgAKJ13tnbD/x9bfxivsfJ6KIsfOoFHL+01kuw=;
h=From:Content-Type:Mime-Version:Subject:Message-Id:To:Date:x-icloud-hme;
b=e9MQ/dVpccMZzvQDAYQonhNY1tWKGeyIVBabr/pulILu4112YefQiLqb6tQfZXo4edc9NzqmTww97kgtgpVZ0V+UwGzL50xyuCum8Q/eENbNArUqTyRyqc8IGevWtMPP9cBourW0md+0J/Rw3xch/V//FmUaIUy0xDIYHAlU4PlXbqEDuq5KIStkTEiHtLu8y4zY03iNkmbe3wUiKrnWwZ4q9KY5Sif1QqBfn/qni3g7Db7DULTs4SL60urVH4bVD7CWgmtYUJGA3hxC13ZrlirAmEhxpp46z6AS+b7dhU7Tf5pg8IQcYTLKCkacURfQa96q4F2aOy8NenRixdgeZQ==
Received: from
p00-icloudmta-smtpin-us-west-2a-60-percent-39.p00-icloudmta-smtpin-vip.icloud-mail-production.svc.kube.us-west-2a.k8s.cloud.apple.com
(unknown [100.81.44.153])
by p00-icloudmta-asmtp-us-west-2a-20-percent-0 (Postfix) with ESMTP id
78220180016B
for <72496 <at> debbugs.gnu.org>; Sun, 02 Aug 2026 14:39:59 +0000 (UTC)
Received: from mail-wr2-f1.google.com (mail-wr2-f1.google.com [74.125.225.65])
by p00-icloudmta-smtpin-us-west-2a-60-percent-39 (Postfix) with
ESMTPS id CCAFCC000B9
for <72496 <at> debbugs.gnu.org>; Sun, 02 Aug 2026 14:39:55 +0000 (UTC)
X-ICL-Info: GAtbRVYDBVFFSlVFSgQEUVUKE0oWX1gHVQoPB0UHAkxES1NZSgIDTENMRhIcDVcGEAsBAhZfQEwZFgEeFnBRDxQQClkbX1tCEx1bEBVRXw5bGgkaWEJVX0JLUk5Ob1cWKh0DFRpFUREqHggCJ19EBSpPFEBMWkESG0xSQUAAAj1CSVdFSAVXBzUQBRsXRVJMFhYLVxBVWg1IFAceFB1BEEdUAEZWV1kNEhUDWRtfW0IFDRRKFVFfDlgOFEVVVgdMEhYJEBRVGAEaFEYTHA1RDxQQClkbX1tCGBACSkQJdFpEPCdDSR0HIzdLS0M8dHNPTUsnR1VyAVFNTVI2S3VzUjA5ARoZWVpMFhYLSQ==
X-ICL-Score: 2.33303322423
X-ARC-Info: policy=fail; arc=none; r1=-20; r2=0
X-DMARC-Policy: v=DMARC1; p=none; sp=quarantine;
rua=mailto:mailauth-reports@HIDDEN
X-DMARC-Info: pass=pass; dmarc-policy=none; s=r1; d=r1; pdomain=gmail.com
Received: by mail-wr2-f1.google.com with SMTP id
ffacd0b85a97d-473913157edso893552f8f.1
for <72496_at_debbugs_gnu_org_6r74jwpn546804_701205ae@HIDDEN>;
Sun, 02 Aug 2026 07:39:53 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1785681593; x=1786286393;
h=date:to:message-id:subject:mime-version:content-type:from:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=JrxD9PgAKJ13tnbD/x9bfxivsfJ6KIsfOoFHL+01kuw=;
b=j4G1IzkL6Bq+qL/knI6O9RDXGnokcptmFKb89MpVzWqahGxErMibXVqTsZClD/P4Ff
GNlmIS0mABUgJlwhb8nLOIg1WK8JGw+cygKC7yPwRGDv3c7fpN6bKiqAEU3u9hBVlR4P
G4iNnaQwY8K1aD62KGJxC3NzkMUVZtw99k24kPUi5dcoI2Drtd1LaOpDBwLTp2ecJhiY
mR5vhfBslKna3IMtwC8SXbLl7TGnzXnaCDoFgKBrFncA65EHSIhnzRSJZDq2lHmKFtnH
6zjQd2zOu/smSuExd5O3yDNqIFr4WQBPgvEEFSWX2Iff1NMKTY+3Y+97Ym8oMCUtdIDN
SckQ==
X-Gm-Message-State: AOJu0Yw2oDSpFPV7Ioo5ptxiCA7Mrc2fEHAFremp32YlQpZv3uajS5uM
PqqRtX8GH0a8Y2xz8SPDR6RXvF+2Xc8lnKGEsCz0PISrb6t9r3C7NG+qCoYXfFn84KDAJg==
X-Gm-Gg: AR+sD12fewMjneMfuV+CB8ugl3I3wPavC3vs0aKESPNzu5Aaqi0lV9KH4ieroomRWzZ
drLevkpfwkbMyclbDCwbvNh58NHw/MlgmsmROceyv76RPjXwjWIdrdElj0+RD+kvhKX1KZqHqrV
msIQ9wZNlCrEb3iaIQgQieSbTpsZX3sDDgWv7H6QJoJF89ot0lRUARuPKYw0pHbTIVZvGhKcnBi
InaFMD+WASaQz5BxIKDsL/5yrHiuiWUFwC6CB+WDSo6F8MG7QNxUhDT3967ZStD02iJHlr2C58M
ReTtdxR8muBe+SBDNZNeSyn7pnpYN79MTpUPhkNtZpX2Jx2H90QDjT6Q/iZOSvUvCs9rWRg6SyE
XS2WcXnlznypU6Ks4qK1Q+heBVISJdL7mpasvpwSRt0fuZ7NiRQ7kUNQaxyDRyLP8aAaWGtKN5k
FuqTW0r3MMWXCVBaBowYdQEUOVuwsSci65N/gimu7RKL7LUIE/7lpdMxNQhQ0PdSclp0tCkNDTH
5No7E0TumyMySNsHM1ucI1rrfXB
X-Received: by 2002:a05:600c:6092:b0:497:ff28:6deb with SMTP id
5b1f17b1804b1-4980c64b8bfmr157076175e9.11.1785681592846;
Sun, 02 Aug 2026 07:39:52 -0700 (PDT)
Received: from smtpclient.apple ([2a01:4b00:89be:b700:1c55:b204:8fa5:9b63])
by smtp.gmail.com with ESMTPSA id
ffacd0b85a97d-47fd64eef60sm19642104f8f.16.2026.08.02.07.39.51
for <72496_at_debbugs_gnu_org_6r74jwpn546804_701205ae@HIDDEN>
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Sun, 02 Aug 2026 07:39:52 -0700 (PDT)
From: plug.rifling_5y@HIDDEN
Content-Type: multipart/mixed;
boundary="Apple-Mail=_186F9EC5-7651-43F5-8BC0-146FDBE30F00"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\))
Subject: Re: bug#72496: 31.0.50 macOS: freezes without beach ball
Message-Id: <79FC9978-BB6D-4B3B-B4C9-AC94E59D8987@HIDDEN>
To: 72496 <at> debbugs.gnu.org
Date: Sun, 2 Aug 2026 15:39:41 +0100
X-Mailer: Apple Mail (2.3864.600.51.1.1)
X-Proofpoint-GUID: IvnG6FaqKrfdTBpuK-pxOQgZ4g-hj2qV
X-Proofpoint-ORIG-GUID: IvnG6FaqKrfdTBpuK-pxOQgZ4g-hj2qV
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODAyMDEzMSBTYWx0ZWRfXxGMJj2qIJrtn
rs2fwACiBKEurKky1wLMr8yZ6ceGyuroQsbzFbqZkHqToEcEBma+EzKs6bPsVKvHhN3MA+VEdJp
/pzc5pdzP/SrmACPX81jAHcA12supU4Y7tIZjzdl0m2ch3MJx86O9ZRv1AMtQnW/5aIcdTmNR1T
jVnDPbwzGPph0/kpUTaVzd8zeI5Rqd+HnN6udULLGdShuauO7TFP/2yaiap7kk6/vHMdchNCPWc
QDwgpLpSiEEIm/6gbdfDd72Hm0iMD7zL46LqmISkJZS0vfQXNEwHWfSxRXwhzRCnQBRZO/b+jwb
HKJZLHMFcVYvMUwiyi6gfjsp7kPnrl7bg0glmFIHloDqX1f3R6V3+TI3Bw9JBk=
X-Authority-Info: v=2.4 cv=AqbjHe9P c=1 sm=1 tr=0 ts=6a6f56bc cx=c_apl:c_pps
a=gzrJ+a5wM+kYexmsmXyuxg==:117 a=xqWC_Br6kY4A:10 a=Sv0fKeRqtYgA:10
a=x7bEGLp0ZPQA:10 a=1PuoHYgjEWIA:10 a=95EFz5htlIgA:10
a=uKRj4MkrK_8B7fUnLCMA:9 a=CjuIK1q_8ugA:10 a=n43FnyOmX13HzinVrRoA:9
a=B2y7HmGcmWMA:10 a=tclcd6dtLQvEqt9_mmAA:9 a=Uz9EnhuHEG25YKoRyM-d:22
X-Authority-Info-Out: v=2.4 cv=As/jHe9P c=1 sm=1 tr=0 ts=6a6f56c0
cx=c_apl:c_pps:t_out a=VIBvfxVZLSH+SK6saaFYJA==:117 a=xqWC_Br6kY4A:10
a=Sv0fKeRqtYgA:10 a=x7bEGLp0ZPQA:10 a=dsJe00tJHUEA:10
a=VkNPw1HP01LnGYTKEx00:22 a=uKRj4MkrK_8B7fUnLCMA:9 a=CjuIK1q_8ugA:10
a=n43FnyOmX13HzinVrRoA:9 a=B2y7HmGcmWMA:10 a=tclcd6dtLQvEqt9_mmAA:9
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72496
X-Mailman-Approved-At: Mon, 03 Aug 2026 00:42:36 -0400
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 (-)
--Apple-Mail=_186F9EC5-7651-43F5-8BC0-146FDBE30F00
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
I think I have found why the app-defined events get lost, and it can be
reproduced on demand.
'ns_send_appdefined' poststhe event with
windowNumber: [[NSApp mainWindow] windowNumber]
While the frame is miniaturized -- or while key/main status is being handed
over -- [NSApp mainWindow] is nil, so that argument is 0. AppKit discards
the event, and [NSApp run] never returns.
That explains why it is permanent rather than intermittent. Nothing
retries: 'send_appdefined' has already been set to NO by the same call, so
every later EV_TRAILER re-post is suppressed, and 'timed_entry' has just
been invalidated. 'ns_read_socket_1', unlike 'ns_select_1', never arms a
'timed_entry', so no timer can wake the loop either. A single lost event
wedges Emacs for good.
Evidence from a live hung process
---------------------------------
macOS 26.5.1, Emacs 30.2, built from source so lldb could attach. Emacs
had been hung for 59 minutes:
[NSApp isRunning] YES -- so stop: was never called
[NSApp mainWindow] nil
[NSApp keyWindow] nil
send_appdefined NO -- latched; no re-post possible
timed_entry NULL -- no timer wake-up either
n_emacs_events_pending 99, and climbing
The stack was:
wait_reading_process_output process.c:5499
redisplay_preserve_echo_area (13) xdisp.c:17757
flush_frame
ns_flush_display
ns_read_socket_1
-[EmacsApp run] -> [super run] <- blocked here
n_emacs_events_pending climbing is the telling part: AppKit was delivering
input normally and Emacs was queueing it. Nothing was blocked or starved.
The only thing missing was the event that ends [NSApp run].
A/B test on that same hung process
----------------------------------
1. Running Emacs' own code inside the hung process --
send_appdefined = YES; ns_send_appdefined (-1); -- changed nothing.
mainWindow was still nil, so the window number was 0 again.
2. Posting a byte-identical NSEventTypeApplicationDefined event that
differed only in carrying a real window number unfroze Emacs
immediately.
The window number is the entire difference.
Reproducer
----------
Miniaturizing makes both mainWindow and keyWindow nil, deterministically.
Any subprocess status change then goes status_notify ->
redisplay_preserve_echo_area (13) -> flush_frame -> ns_flush_display ->
ns_read_socket_1. So:
(run-at-time 3 3 (lambda () (start-process "probe" nil "sleep" "1")))
then miniaturize the frame and wait. Emacs is dead, and deminiaturizing
does not bring it back.
This also matches the reports of freezes on app activation and on the green
zoom button's tiling menu: those take main/key status away too.
Verification of the patch
-------------------------
With the patch applied, in the same miniaturized state ([NSApp mainWindow]
== nil), a breakpoint on -[NSApplication postEvent:atStart:] shows:
type = 15 (NSEventTypeApplicationDefined)
windowNumber = 3516
data1 = -1
and 80 seconds of the reproducer above, with about 27 subprocess exits,
produced no freeze.
Note that keyWindow is nil while miniaturized as well, so it is the scan
over [NSApp windows] that actually does the work here; a fallback that only
tried keyWindow would not fix anything.
The patch is against master (the function is unchanged from Emacs 30.2, and
it applies to both).
I have not signed FSF copyright papers. The change is about 12 lines of
code plus a comment; I am happy to shorten it, or for someone to rewrite it
on the strength of the diagnosis alone if that is easier.
--Apple-Mail=_186F9EC5-7651-43F5-8BC0-146FDBE30F00
Content-Disposition: attachment;
filename=0001-Fix-a-permanent-hang-on-macOS-when-no-window-is-main.patch
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="0001-Fix-a-permanent-hang-on-macOS-when-no-window-is-main.patch"
Content-Transfer-Encoding: quoted-printable
=46rom=200000000000000000000000000000000000000000=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20Anton=20Dergunov=20<adergunov.login@HIDDEN>=0A=
Subject:=20[PATCH]=20Fix=20a=20permanent=20hang=20on=20macOS=20when=20no=20=
window=20is=20main=0A=0A'ns_send_appdefined'=20posted=20the=20event=20=
that=20ends=20[NSApp=20run]=20with=0AwindowNumber:=20[[NSApp=20=
mainWindow]=20windowNumber].=20=20While=20the=20frame=20is=0A=
miniaturized,=20or=20while=20key/main=20status=20is=20being=20handed=20=
over,=20[NSApp=0AmainWindow]=20is=20nil=20and=20the=20window=20number=20=
is=200;=20AppKit=20discards=20such=20an=0Aevent,=20so=20[NSApp=20run]=20=
never=20returns=20and=20Emacs=20never=20gets=20back=20to=20its=0Acommand=20=
loop.=0A=0AThe=20hang=20is=20permanent=20rather=20than=20intermittent=20=
because=20nothing=20retries:=0A'send_appdefined'=20has=20already=20been=20=
cleared=20by=20this=20same=20call,=20so=20every=0Alater=20EV_TRAILER=20=
re-post=20is=20suppressed,=20and=20'timed_entry'=20has=20just=20been=0A=
invalidated.=20=20Unlike=20'ns_select_1',=20'ns_read_socket_1'=20never=20=
arms=20a=0A'timed_entry',=20so=20no=20timer=20can=20wake=20the=20loop=20=
either.=0A=0ANote=20that=20[NSApp=20keyWindow]=20is=20nil=20while=20=
miniaturized=20too,=20so=20the=20scan=0Aover=20[NSApp=20windows]=20is=20=
the=20fallback=20that=20actually=20applies.=0A=0A*=20src/nsterm.m=20=
(ns_send_appdefined):=20Address=20the=20app-defined=20event=20to=20a=0A=
window=20that=20exists.=20=20(Bug#72496)=0A---=0A---=20a/src/nsterm.m=0A=
+++=20b/src/nsterm.m=0A@@=20-4686,6=20+4686,7=20@@=0A=20=20=20if=20=
(send_appdefined)=0A=20=20=20=20=20{=0A=20=20=20=20=20=20=20NSEvent=20=
*nxev;=0A+=20=20=20=20=20=20NSWindow=20*dest;=0A=20=0A=20=20=20=20=20=20=20=
/*=20We=20only=20need=20one=20NX_APPDEFINED=20event=20to=20stop=20NXApp=20=
from=20running.=20=20*/=0A=20=20=20=20=20=20=20send_appdefined=20=3D=20=
NO;=0A@@=20-4697,12=20+4698,29=20@@=0A=20=20=20=20=20=20=20=20=20=20=20=
[timed_entry=20release];=0A=20=20=20=20=20=20=20=20=20=20=20timed_entry=20=
=3D=20nil;=0A=20=20=20=20=20=20=20=20=20}=0A+=0A+=20=20=20=20=20=20/*=20=
Address=20the=20event=20to=20a=20window=20that=20actually=20exists.=20=20=
With=20no=20main=0A+=20=20=20=20=20=20=20=20=20window=20--=20=
miniaturized,=20or=20mid=20handover=20of=20key/main=20status=20--=20the=0A=
+=20=20=20=20=20=20=20=20=20window=20number=20would=20be=200=20and=20=
AppKit=20would=20silently=20discard=20the=0A+=20=20=20=20=20=20=20=20=20=
event.=20=20That=20is=20fatal=20here:=20send_appdefined=20has=20just=20=
been=20cleared=0A+=20=20=20=20=20=20=20=20=20and=20timed_entry=20=
invalidated,=20so=20nothing=20would=20ever=20end=20[NSApp=20run]=0A+=20=20=
=20=20=20=20=20=20=20again,=20and=20Emacs=20would=20hang=20forever=20=
with=20its=20UI=20unresponsive.=20=20*/=0A+=20=20=20=20=20=20dest=20=3D=20=
[NSApp=20mainWindow];=0A+=20=20=20=20=20=20if=20(dest=20=3D=3D=20nil)=0A=
+=20=20=20=20=20=20=20=20dest=20=3D=20[NSApp=20keyWindow];=0A+=20=20=20=20=
=20=20if=20(dest=20=3D=3D=20nil)=0A+=20=20=20=20=20=20=20=20for=20=
(NSWindow=20*cand=20in=20[NSApp=20windows])=0A+=20=20=20=20=20=20=20=20=20=
=20if=20([cand=20windowNumber]=20>=200)=0A+=20=20=20=20=20=20=20=20=20=20=
=20=20{=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20dest=20=3D=20cand;=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20break;=0A+=20=20=20=20=20=20=20=
=20=20=20=20=20}=0A=20=0A=20=20=20=20=20=20=20nxev=20=3D=20[NSEvent=20=
otherEventWithType:=20NSEventTypeApplicationDefined=0A=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20location:=20NSMakePoint=20(0,=200)=0A=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20modifierFlags:=200=0A=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20timestamp:=200=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20windowNumber:=20[[NSApp=20=
mainWindow]=20windowNumber]=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20windowNumber:=20[dest=20=
windowNumber]=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20context:=20[NSApp=20=
context]=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20subtype:=200=0A=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20data1:=20value=0A--=20=0A2.39.5=0A=0A=
--Apple-Mail=_186F9EC5-7651-43F5-8BC0-146FDBE30F00
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
--Apple-Mail=_186F9EC5-7651-43F5-8BC0-146FDBE30F00--
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.Eli Zaretskii <eliz@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.Received: (at 72496) by debbugs.gnu.org; 8 Jun 2025 04:43:42 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 08 00:43:42 2025 Received: from localhost ([127.0.0.1]:50365 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uO7sk-00065C-BB for submit <at> debbugs.gnu.org; Sun, 08 Jun 2025 00:43:42 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:45257) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>) id 1uO7sh-00064q-Hp; Sun, 08 Jun 2025 00:43:40 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-453066fad06so3317515e9.2; Sat, 07 Jun 2025 21:43:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749357813; x=1749962613; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xvqoda8CT7lDG9/BJg6BSvzeVdAk8DOZKMamuKO0Rqc=; b=bLRwzoxkeGWW5s4nm2nheQ1GnPJ9FSECAoEJ1ltL1NR//ON65aXPYIl4anfq8byDoX hls4UXuj/RRCqdcpJwgP3jfkoc3yWVFBgVEH8LC5zsTW4S+v72OrrCg5oy6zGNN+gn0I 0Z0CofcHT9FFjpNZGfR53UCtfHhW8LOPmBD6LH0K0f3HIPWBs4i6Gx7Xh7+uabBnHTn3 zImoA9ydhv5okT9QH027ufUHFbqccnkJ6mXgZgLNEoJyVzsh0KLgv3zTqP2SG5oJB3zW foAMXiYJvS3lV2/eFUCAiYAohFOUUNTGPguBjRjkcFJn+AihFbcETfF4nKuIIV95irOv re+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749357813; x=1749962613; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xvqoda8CT7lDG9/BJg6BSvzeVdAk8DOZKMamuKO0Rqc=; b=vSg+QqpNEoefsfwlfxNQIxGa1YLmV4dUnIU6myKpB1CJb7CgYIyTV5GJG+9wIFMnMG R+uhvGisW9/2Gw82qahjjrRzoh6BRBPqnuLVjQ0CNtngiyw5R3KhPijcYJeXl7hiE+Pq yl1bTRn+esOdB7tW9TxqdH/e3e5Dwt/wh6+4SGuX9hrWv5wVVvOxmvbkOhG9ItgvuAL/ I/1bCZimOHB6zYv4DS0hwsGW74KWxvhku4LrheEatUboFMWMNkpZCKt5VYd7Qc7MBZ4u E4J16fZymU4H1OkNnXvN/aIp83tZtzuF56iFJc5CNbgLmIYD3E8jveEiVIwmRNYlscoa WWBg== X-Forwarded-Encrypted: i=1; AJvYcCXtLekOo9MSwfp7YxJAMwugWM8yVBzFol3rqMiZh7MGqSNmO/6Za6Nyi9U6EyiuHJJS2Ns27Q==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzYy5Bdx+n2lP1jkzpWOjoC0ybWuRMmsoxVmM5zBJLXm6oNVk3k jqTKXuQR5m91cl5MNl2bmTBKEbbnfj8sssk33vPBIZOy/tfEjTWzBZ40ML696bdt X-Gm-Gg: ASbGncvU0korCWHZBtuxUJTBb+L+Ary7TDRgOWtP3+I8Dto61t/y1iSU6O08XMmYYEP ddx7cx34+9D1o2wA+aJBrBw5+eQ4Woqo+fwYUe9tGyO70gC2JCJ0Qh8Jwpi425NbyXlvYfq9lGY 9nme37dB95I22kttBIt+BiLlxV7Fmlijg8G+EEBtCkmsboVynfNuD38bj7EkL04T4UqnIGkyO5u plwKR3KX+bz4F4wOieR4ukRETNL2po+G+cnVJ6iLg8pGX5dgECoplp8cVBDBdflLR4bHQpvk5sU edzwAxoIbkqNi7bmsS8SrFaaNL5HnXq98i+jPth9wJQuh+A8AP/XQXFXT40iL47WmTted5D/782 dGzpaFedWFWg0A4gCeHU5DDq3iij6e0e+xx5DAHXDMfiivPXDKFnNB/KCavFd X-Google-Smtp-Source: AGHT+IE5iuuUfsRj3kBORulKv/jeL3XkxHqvc5Tljb0qd4bj668wb0iqcMVx2TEs+eq2jNIGY8I2Hw== X-Received: by 2002:a05:600c:1e1c:b0:43c:fe5e:f040 with SMTP id 5b1f17b1804b1-452fbbf6c36mr55144555e9.23.1749357812576; Sat, 07 Jun 2025 21:43:32 -0700 (PDT) Received: from pro2 (p200300e0b72aee005cffa46ecc1e2213.dip0.t-ipconnect.de. [2003:e0:b72a:ee00:5cff:a46e:cc1e:2213]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-451f828715esm74323115e9.0.2025.06.07.21.43.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Jun 2025 21:43:32 -0700 (PDT) From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#72496: 31.0.50; macOS: freezes without beach ball In-Reply-To: <m234cpxs7t.fsf_-_@HIDDEN> References: <CAONXnca4WC_RpkUjYbFDQcQTA4=za5rHnD1_1-Ah38s0NE_HAA@HIDDEN> <861pzbimu0.fsf@HIDDEN> <m25xonqzty.fsf@HIDDEN> <86h687gxrf.fsf@HIDDEN> <m2wmh3pc12.fsf@HIDDEN> <m234cpxs7t.fsf_-_@HIDDEN> Date: Sun, 08 Jun 2025 06:43:31 +0200 Message-ID: <m2y0u2zvv0.fsf_-_@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 72496 Cc: adamkshannon@HIDDEN, 74369 <at> debbugs.gnu.org, 72496 <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 (-) Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes: > Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes: > > FWIW, and for posterity, I am now using the patch below. This makes the > freezes without beach ball that I described literally impossible.=20 I take that back since I got another freeze with that patch.
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.
Received: (at 72496) by debbugs.gnu.org; 28 May 2025 04:41:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 28 00:41:28 2025
Received: from localhost ([127.0.0.1]:48447 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1uK8bX-0004tJ-Hx
for submit <at> debbugs.gnu.org; Wed, 28 May 2025 00:41:27 -0400
Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:45277)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
id 1uK8bP-0004sB-C4; Wed, 28 May 2025 00:41:20 -0400
Received: by mail-wm1-x335.google.com with SMTP id
5b1f17b1804b1-43cfebc343dso31444755e9.2;
Tue, 27 May 2025 21:41:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1748407273; x=1749012073; darn=debbugs.gnu.org;
h=content-transfer-encoding:mime-version:user-agent:message-id:date
:references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=NwnshL1bKVA3OkaBlnKsFmsEUqmAcyhXtPveR9F/7hA=;
b=RVAwqepMeLA7OQqvC74CxxNnmQk35IlMKsPkVUm3Q/PNJ1wjG3DvlHM+hnxAmWndTM
rLZSvwsvuONY952uhaEuDZSVAuM7ly8Dtv4ntbPvDw5Z6XtyWZmXWYdw6b1TP6xBZRDd
sKOmpKtzXtGnqDIZbJd4oyn2KFYim5tZcuus8SGHW3BMjgXdx5bXgZa5WwW46WAG29G5
j0/gpw5ebYDgpVVPt7hwt+S/c+oHzAwX7HPmfpU/O6bxV1eWXXpAWOdnPal/+7OnNSXv
/DjgvLmBPCzWIjfoxXdAk5TMN9U3nZPHR0/guLAIYurb2wZcUVw+gZ/3FNOu7FKVX3qT
hHLQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1748407273; x=1749012073;
h=content-transfer-encoding:mime-version:user-agent:message-id:date
:references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to;
bh=NwnshL1bKVA3OkaBlnKsFmsEUqmAcyhXtPveR9F/7hA=;
b=jeR+gxdt8K5dqAhAS+qH2Dcp5iHOv4+xbIi87olE4sxe26lpMFY75FdqjlI+RxaozS
HP0Jv3NvS2Gkh36Pv5xyAL4W0S7lKaWpAtBQTZHTYJ//cSj0ZsFmVFZQnBIjtDhdg8OJ
cwg8JIDiNDnX3o5mQOIhVC8iOHe4ZYZ1qILqt3P/sQfh4epqUv3ZKSk7yGKxBqlXrpJT
2E7ABTfJ3WzFzRcZZW2cKTaVn7ABvXvi3kT41DBO+kBe3rtIWVAO/Z60dVsRfdv4uGlQ
YnCyLk980HFd8wCtnZUdbHordB4DL5K5AWi/luJbZpLdf5ryeBFb+wNeI6Hzm5X7geJ2
ypsA==
X-Forwarded-Encrypted: i=1;
AJvYcCUDBc9oWekYR5KLvZv71Xz1YXyakutR43r4+c6JzaXVrOV6Wpas5uj1CZTP7lzXOThVz/tWrA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzU+0/yTQmIVaaSXKFMt15phY26iTy2TF7StDxbDXScIbX79etf
gLGd5KZ/qkxwzVQlSK/ky5FhYGF4UKH3soAtQuqlsazkMDiabrniIAKWDtGx8w==
X-Gm-Gg: ASbGnct3UkkiIHeuGW3kKLIY/LS74nt1zgUulM1VEWNbqn6Jd2X8kVNBp/VFRW5JDWu
oIegCktTNhfOyQOL6c2B7W4McFpXDBzVfyQus03rKFJ7h06Qu0dw81RMj6p5+t1bX6JwAo5ptE9
QZpHLjhNYzo/vQOZRKXurpPw3vUOjSu3PZfjXhtNo5x2xIuvlB1DJEe9T3BQm7TLEyGxh5UTgdN
Ugd/KM1+Hik7UvXU08qphSewYLewm7IdbV89qsaSpJih4ynopX5fVn2/9sX+ERcnLrnByhqTa0E
uowA0HGH76cPAcYoqeC8r8rl4xOqwLv28CcP+9TRvtrqtg8S53QwGrWiBBF7hxxuU4glPcUZDzf
4vFn6sG69RUJ8A9tNvlxIV8sPjCW9dLx7eYGM1KbLMZ1Y1WQBMVg8HEO/DG8D
X-Google-Smtp-Source: AGHT+IHAdVUAcoYrw9tHDu2P9vWepCvEjQRxdfHgeiNhtxA9RU8TfkHWTkoJ9UMBnnXbsxzQnV/LrA==
X-Received: by 2002:a05:600c:5396:b0:43c:fe5e:f040 with SMTP id
5b1f17b1804b1-45077e36cc8mr3773085e9.23.1748407272719;
Tue, 27 May 2025 21:41:12 -0700 (PDT)
Received: from pro2 (p200300e0b7415d0058eee22c49b89973.dip0.t-ipconnect.de.
[2003:e0:b741:5d00:58ee:e22c:49b8:9973])
by smtp.gmail.com with ESMTPSA id
5b1f17b1804b1-450064a1bdbsm8452185e9.14.2025.05.27.21.41.11
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 27 May 2025 21:41:11 -0700 (PDT)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#72496: 31.0.50; macOS: freezes without beach ball
In-Reply-To: <m2wmh3pc12.fsf@HIDDEN>
References: <CAONXnca4WC_RpkUjYbFDQcQTA4=za5rHnD1_1-Ah38s0NE_HAA@HIDDEN>
<861pzbimu0.fsf@HIDDEN> <m25xonqzty.fsf@HIDDEN>
<86h687gxrf.fsf@HIDDEN> <m2wmh3pc12.fsf@HIDDEN>
Date: Wed, 28 May 2025 06:41:10 +0200
Message-ID: <m234cpxs7t.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72496
Cc: 74369 <at> debbugs.gnu.org, adamkshannon@HIDDEN, 72496 <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 (-)
Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:
FWIW, and for posterity, I am now using the patch below. This makes the
freezes without beach ball that I described literally impossible.=20
1 file changed, 17 insertions(+), 1 deletion(-)
src/nsterm.m | 18 +++++++++++++++++-
modified src/nsterm.m
@@ -6132,7 +6132,23 @@ - (void)sendEvent: (NSEvent *)theEvent
=20
NSTRACE_UNSILENCE();
=20
- [super sendEvent: theEvent];
+ [super sendEvent:theEvent];
+
+#ifdef NS_IMPL_COCOA
+ /* We have the problem that app-defined events get lost for an unknown
+ reason. When that happens, Emacs still processes NS events, and no
+ beach ball is displayed. But Emacs' own event loop does not gain
+ control again and it doesn't react to input anymore. */
+ if ([NSApp modalWindow] !=3D nil)
+ return;
+
+ static int count =3D 0;
+ if (++count =3D=3D 10)
+ {
+ count =3D 0;
+ [self stop: self];
+ }
+#endif
}
=20
=20
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.Gerd Möllmann <gerd.moellmann@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.
Received: (at 72496) by debbugs.gnu.org; 10 Aug 2024 09:19:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 10 05:19:57 2024
Received: from localhost ([127.0.0.1]:39065 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1sciGT-0008Bj-3D
for submit <at> debbugs.gnu.org; Sat, 10 Aug 2024 05:19:57 -0400
Received: from mail-ed1-f49.google.com ([209.85.208.49]:56754)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <gerd.moellmann@HIDDEN>) id 1sciGP-0008BS-0n
for 72496 <at> debbugs.gnu.org; Sat, 10 Aug 2024 05:19:56 -0400
Received: by mail-ed1-f49.google.com with SMTP id
4fb4d7f45d1cf-5af51684d52so3133305a12.1
for <72496 <at> debbugs.gnu.org>; Sat, 10 Aug 2024 02:19:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1723281497; x=1723886297; darn=debbugs.gnu.org;
h=content-transfer-encoding:mime-version:user-agent:message-id:date
:references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=2DpSXqZBPmJuIQ0SmhAJR3awarKKoUt52YYe5R9uuCw=;
b=MnhuG1ckUI1vxUW3oIQBvyZMJ8eMuLoLMx0XA0XAHNRGVCWNS0TD8qHYYSAQib8p32
+kZgR5t3/UvwWM+f1YlyfpY/rXn0BMoKTNxSDW5SdSn3DlfCp1/tQay35nidvbrwmcJk
p3Ou3Ucxt1kfBqLScq4UgluYU6AzMJ79aRz44xnLCt7N3XcPl9nrAnJidx15/I8iCwJ7
o9DCIrUEeLWq5OPiClJhv09nl7pnJVtgaSGaRy03lXWTEZxTWcNjDCiVpgB8eMV2hOgS
LX0BXXHOPfTucOF4NkBeksq3w5bgbA6NWsC/hjPxi/3e1ux7Fn3clQ0Q0F9zYhcJpkgb
8YBQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1723281497; x=1723886297;
h=content-transfer-encoding:mime-version:user-agent:message-id:date
:references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to;
bh=2DpSXqZBPmJuIQ0SmhAJR3awarKKoUt52YYe5R9uuCw=;
b=pgf138buwfBswJOb3dHE6nImOIpzCaMFocdixPYw/EdcniEMVCJxmb+fYD2xIHbZKQ
wah8w9+r1CFjng4xPPmBJuOblK+TvRwgxEX9z4AuTqOMEz7vmdEHZ8X+POKxNTu/eXoq
giuUkrf3nRM3GbPFcSOAi4DibjZii9LHlbiPvdq2pnLLrcRElVTyOjtau6NPwgeA8bPF
YZYqeh9XSBW24UF5+7FdAfrPjua0eCX3rV0fd+h9Iv+QHMoJjTEyCbjXIASh9QoqMLl1
mzXDE0IXKT4GY5HdjfVzwVwjr3hIdGH55DHlMu0iZf5KfjqbCb2bzsFw5pTL3sztcOfT
u3Iw==
X-Gm-Message-State: AOJu0Yyn7rrp1BhiyP5nBnd+pCaLusgigN0Qcd5bLDOfRA3AZUePgGPX
d8jEDGMePjWJgU5dQWLlT0KDgYGVJGcku1qDGa19pxChWWYg7dxlet5tBw==
X-Google-Smtp-Source: AGHT+IErxom1Me4CWjZrLI5cpPl7ET1+W5pKnW+98tR4aSZsrMEprtZLAr9Gk/WexAdeAsPiwq3trg==
X-Received: by 2002:a17:907:f716:b0:a7a:9d1e:3b26 with SMTP id
a640c23a62f3a-a80aa5e56b0mr282195766b.37.1723281497083;
Sat, 10 Aug 2024 02:18:17 -0700 (PDT)
Received: from pro2.fritz.box (p4fe3a01c.dip0.t-ipconnect.de. [79.227.160.28])
by smtp.gmail.com with ESMTPSA id
a640c23a62f3a-a80bb1cd2a8sm53054966b.117.2024.08.10.02.18.16
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sat, 10 Aug 2024 02:18:16 -0700 (PDT)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#72496: 31.0.50; macOS: freezes without beach ball
In-Reply-To: <m234nfd1sm.fsf@HIDDEN> ("Gerd =?utf-8?Q?M=C3=B6llman?=
=?utf-8?Q?n=22's?= message of "Thu, 08 Aug 2024 07:24:57 +0200")
References: <m2ikwd6a8w.fsf@HIDDEN> <865xsdpusi.fsf@HIDDEN>
<m25xsd8v6w.fsf@HIDDEN> <86wmkto7dh.fsf@HIDDEN>
<m21q318pl7.fsf@HIDDEN> <m234nfd1sm.fsf@HIDDEN>
Date: Sat, 10 Aug 2024 11:18:15 +0200
Message-ID: <m24j7spwh4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72496
Cc: 72496 <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 (-)
Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:
> Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:
>
>> Eli Zaretskii <eliz@HIDDEN> writes:
>>
>>>> From: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>
>>>> Cc: 72496 <at> debbugs.gnu.org
>>>> Date: Tue, 06 Aug 2024 18:36:39 +0200
>>>>=20
>>>> I've tried this
>>>>=20
>>>> (when (fboundp 'ns-app-stop)
>>>> (defun sigusr1-handler ()
>>>> (interactive)
>>>> (message "SIGUSR1 - stop event loop")
>>>> (ns-app-stop))
>>>> (keymap-set special-event-map "<sigusr1>" 'sigusr1-handler))
>>>>=20
>>>> where ns-app-stop does such a ns_send_appdefined, but that didn't work
>>>> for a reason unknown to me.
>>>
>>> Maybe the way SIGUSR1 is handled involves the same event queue that is
>>> botched in this scenario?
>>
>> Yes, that's quite likely. I had a little hope that a signal would maybe
>> handled in some special way, but apparently not.
>
> I'm now running locally with the attached change. This removes the
> global variable that can prevent sending app-defined events when set
> wrong. Instead, I'm using [NSApplication nextEventMatchingMask] to check
> if an app-defined event has already been posted. This is infinelty less
> dangerous.
>
> Let's see if that is the problem.
I don't even know if this is related to my change to ns_send_appdefined, but
I got a freeze today while using child frames (vertico + posframe) that
I haven't seen before. Event the mouse behaved strangely on the whole
macOS until I killed the process. That was without beach ball.
So, whatever that was, my patch at least didn't help, if it wasn't
causing it.
I give up. I'll switch to using tty Emacs.
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.
Received: (at 72496) by debbugs.gnu.org; 8 Aug 2024 05:26:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 08 01:26:34 2024
Received: from localhost ([127.0.0.1]:35333 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1sbvfW-00071F-4R
for submit <at> debbugs.gnu.org; Thu, 08 Aug 2024 01:26:34 -0400
Received: from mail-ej1-f49.google.com ([209.85.218.49]:47488)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <gerd.moellmann@HIDDEN>) id 1sbvfU-000711-8z
for 72496 <at> debbugs.gnu.org; Thu, 08 Aug 2024 01:26:32 -0400
Received: by mail-ej1-f49.google.com with SMTP id
a640c23a62f3a-a7d2a9a23d9so62361566b.3
for <72496 <at> debbugs.gnu.org>; Wed, 07 Aug 2024 22:26:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1723094700; x=1723699500; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=AZaygRDVDWgT1DJoBxfVJM8urYw2ew99cd2EgkLsQuo=;
b=D02riPIfuOuNqlXvDKcFEgnbUggJnXt4MMm5Tj7N1/BNBA0HIOrywzhVtYHcTBWlcq
tVdGrYcegqiYo2dlOxEzy6hY+leRyiLULjP+y72ed26Ei7b34BXX3X1KzEvBaggLcg1u
S70PKmLXkT0+6xk4ry2Wfx99c3ZZbyRMTmjVOMAFzMsB1WYYOE2M0ENTShousB2Jim2O
p0siuMjopsl4u79AsRyRMlKHf6864kFpjPI1Fmshach3IXsdDHzfYJ1Wqywh/yzZzxwB
dHL7VYS+J42mn7CV1ymWnXJ1cyBYDIicfI3xDVZzurTb3lysqLnqTXml22+iUkgLi13G
wkWQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1723094700; x=1723699500;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=AZaygRDVDWgT1DJoBxfVJM8urYw2ew99cd2EgkLsQuo=;
b=VwM1ZKoEkkEqh6Ma0t0m2W3Lj6N3I7nqF9gZFjGwMmiBWUNr9FLVjpKQqBbRJUT9j1
1YK738xhJHHamWLGiHB0alFz4SiFdS7VD322nHryYz3nbIMT1qE7Gnt41Fp+0kGgurBl
GRqSj5fOgfPwhJoWeL8/iLmb1C0hh5ZE6woPJpcEPGqCwQ6eb7pEz/6F4I6btfFMl/Gx
UjUl3QcCG3w1fF++PLVZB/tWPdhU/yWBUtNcbB2r2AVwrMQPDB8xZTBvuf9m/8vhQQaG
Fyjy23DG6Lx3asryvdVETTe+ZrkGe3MVNTeiNJm7EAbWObr/9ZO55TZbRl1Y0UxJSGlW
UdCw==
X-Gm-Message-State: AOJu0Ywg/ERX2DY3KQKKGsCNa7jwSEllfYqhuxzRW1zwPsl0cSMrMlCq
WCq/L+dTnFLzZCjFw3Ek1taCjndYxzeknKV5iaDPsWndVteQAfP6tBoJEQ==
X-Google-Smtp-Source: AGHT+IE1S5lU0U9sN3nS6GhrTwybiTnd4r8rn9zc5CqU3av5ZjBCOI5eEmpGfVZGFI6W26r+Vtk6HQ==
X-Received: by 2002:a17:907:d581:b0:a77:bfca:da57 with SMTP id
a640c23a62f3a-a8090e62284mr42513966b.44.1723094699699;
Wed, 07 Aug 2024 22:24:59 -0700 (PDT)
Received: from pro2.fritz.box (p4fe3a254.dip0.t-ipconnect.de. [79.227.162.84])
by smtp.gmail.com with ESMTPSA id
a640c23a62f3a-a7dc9bc3d77sm695741066b.43.2024.08.07.22.24.58
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 07 Aug 2024 22:24:59 -0700 (PDT)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#72496: 31.0.50; macOS: freezes without beach ball
In-Reply-To: <m21q318pl7.fsf@HIDDEN> ("Gerd =?utf-8?Q?M=C3=B6llman?=
=?utf-8?Q?n=22's?= message of "Tue, 06 Aug 2024 20:37:40 +0200")
References: <m2ikwd6a8w.fsf@HIDDEN> <865xsdpusi.fsf@HIDDEN>
<m25xsd8v6w.fsf@HIDDEN> <86wmkto7dh.fsf@HIDDEN>
<m21q318pl7.fsf@HIDDEN>
Date: Thu, 08 Aug 2024 07:24:57 +0200
Message-ID: <m234nfd1sm.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72496
Cc: 72496 <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 (-)
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:
> Eli Zaretskii <eliz@HIDDEN> writes:
>
>>> From: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>
>>> Cc: 72496 <at> debbugs.gnu.org
>>> Date: Tue, 06 Aug 2024 18:36:39 +0200
>>>=20
>>> I've tried this
>>>=20
>>> (when (fboundp 'ns-app-stop)
>>> (defun sigusr1-handler ()
>>> (interactive)
>>> (message "SIGUSR1 - stop event loop")
>>> (ns-app-stop))
>>> (keymap-set special-event-map "<sigusr1>" 'sigusr1-handler))
>>>=20
>>> where ns-app-stop does such a ns_send_appdefined, but that didn't work
>>> for a reason unknown to me.
>>
>> Maybe the way SIGUSR1 is handled involves the same event queue that is
>> botched in this scenario?
>
> Yes, that's quite likely. I had a little hope that a signal would maybe
> handled in some special way, but apparently not.
I'm now running locally with the attached change. This removes the
global variable that can prevent sending app-defined events when set
wrong. Instead, I'm using [NSApplication nextEventMatchingMask] to check
if an app-defined event has already been posted. This is infinelty less
dangerous.
Let's see if that is the problem.
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
filename=0001-NS-Send-application-defined-event-differently-bug-72.patch
Content-Description: nsterm.m patch
From f48aafd73c7d2694bf2c9e980e9624bde9ab3b3e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gerd=20M=C3=B6llmann?= <gerd@HIDDEN>
Date: Thu, 8 Aug 2024 06:57:21 +0200
Subject: [PATCH] NS: Send application-defined event differently (bug#72496)
* src/nsterm.m (send_appdefined): Global variable removed, all uses
removed.
(ns_send_appdefined): Check if an application-defined event is already
queued with [NSApplicaton nextEventMatching]. Post an event if not.
---
src/nsterm.m | 26 ++++++++++----------------
1 file changed, 10 insertions(+), 16 deletions(-)
diff --git a/src/nsterm.m b/src/nsterm.m
index 5588425686b..594f7ba974b 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -309,7 +309,6 @@ - (unsigned long)unsignedLong
#endif
/* event loop */
-static BOOL send_appdefined = YES;
#define NO_APPDEFINED_DATA (-8)
static int last_appdefined_event_data = NO_APPDEFINED_DATA;
static NSTimer *timed_entry = 0;
@@ -507,7 +506,6 @@ - (unsigned long)unsignedLong
hold_event_q.q[hold_event_q.nr++] = *event;
/* Make sure ns_read_socket is called, i.e. we have input. */
raise (SIGIO);
- send_appdefined = YES;
}
static Lisp_Object
@@ -4689,13 +4687,17 @@ Function modeled after x_draw_glyph_string_box ().
/* Only post this event if we haven't already posted one. This will end
the [NXApp run] main loop after having processed all events queued at
this moment. */
- if (send_appdefined || value == -42)
+
+ NSEvent *app_defined_event =
+ [NSApp nextEventMatchingMask: NSEventMaskApplicationDefined
+ untilDate: nil
+ inMode: NSDefaultRunLoopMode
+ dequeue: NO];
+
+ if (app_defined_event == nil)
{
NSEvent *nxev;
- /* We only need one NX_APPDEFINED event to stop NXApp from running. */
- send_appdefined = NO;
-
/* Don't need wakeup timer any more. */
if (timed_entry)
{
@@ -4812,7 +4814,6 @@ Function modeled after x_draw_glyph_string_box ().
{
/* Run and wait for events. We must always send one NX_APPDEFINED event
to ourself, otherwise [NXApp run] will never exit. */
- send_appdefined = YES;
ns_send_appdefined (-1);
[NSApp run];
@@ -4907,7 +4908,6 @@ Function modeled after x_draw_glyph_string_box ().
// outerpool = [[NSAutoreleasePool alloc] init];
- send_appdefined = YES;
if (nr > 0)
{
pthread_mutex_lock (&select_mutex);
@@ -4951,7 +4951,6 @@ Function modeled after x_draw_glyph_string_box ().
else /* No timeout and no file descriptors, can this happen? */
{
/* Send appdefined so we exit from the loop. */
- ns_send_appdefined (-1);
}
block_input ();
@@ -6051,10 +6050,6 @@ - (void)sendEvent: (NSEvent *)theEvent
last_appdefined_event_data = [theEvent data1];
[self stop: self];
}
- else
- {
- send_appdefined = YES;
- }
}
@@ -7727,7 +7722,7 @@ - (void)mouseMoved: (NSEvent *)e
help_echo_object, help_echo_pos);
}
- if ((*emacsframe)->mouse_moved && send_appdefined)
+ if ((*emacsframe)->mouse_moved)
ns_send_appdefined (-1);
}
@@ -8336,8 +8331,7 @@ - (void)windowDidExpose: sender
SET_FRAME_VISIBLE (*emacsframe, 1);
SET_FRAME_GARBAGED (*emacsframe);
- if (send_appdefined)
- ns_send_appdefined (-1);
+ ns_send_appdefined (-1);
}
--
2.46.0
--=-=-=--
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.Received: (at 72496) by debbugs.gnu.org; 6 Aug 2024 18:39:17 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 06 14:39:17 2024 Received: from localhost ([127.0.0.1]:33044 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sbP5Z-0006Jk-3L for submit <at> debbugs.gnu.org; Tue, 06 Aug 2024 14:39:17 -0400 Received: from mail-ed1-f53.google.com ([209.85.208.53]:50324) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>) id 1sbP5U-0006JR-Q8 for 72496 <at> debbugs.gnu.org; Tue, 06 Aug 2024 14:39:15 -0400 Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5b3fff87e6bso1216753a12.0 for <72496 <at> debbugs.gnu.org>; Tue, 06 Aug 2024 11:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722969462; x=1723574262; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xINGUaLMcQ8TqD+ytEO6FVNj7OZTv+xhP/CYU54Hxf8=; b=YrRVDP1ZsQb9oC8Simg2NJEIMSeCwJn9M0n5n5Az6+f96QE4VID3/9THP9QRtdvABI zKNfCbhzaz/Xeg8KckzmCkcFYjkrjeX+bG3E+7a7B5FWrpkA79vPMh6Ed9ma6ndx1doB z1UQWcyuV42K1zeh3DTR7mLstC7089Ht4Afd6YIk6narpcYp+m0kyzgJ8loEgJRGnEjn Wa7Glg2l9QDiClM5Y9lCVd6vRgmqAo7ynS8FydJUwKXiAmbBshGKQlBArAzseF47M9DK FZBV4wKvidik4r+p9uHsOPBkyOHawQD5eEQpSQWY3WshqK7FEnZV6KQ02JWWV05DEnkt axUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722969462; x=1723574262; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xINGUaLMcQ8TqD+ytEO6FVNj7OZTv+xhP/CYU54Hxf8=; b=YTpa7vd8GA6o4n+qRe31GLx6sQ/+iG6E9oHgviWcNV/Fuk8s920BNWSk6P14c/RBXO UQ6oGsZR0Fls6XTuDl1QQQEFR0NbxJy6Jn2yzRN2LWE7T+DjcG1SRTEaVtlq80x+/CQg LYHfX2v86hUqq0CwDGFc0PX8h+ExIG9/lq+WQRINT2SmqLtW69f0Wn96osK/yLf09PE1 XvtdMpbAPfaZro/Hh3NqOtNvJk9gowI3IiCtFyMtK+RXP+i9IQCiGDIzKcIgYYtQ/K3r gv8vblrrYG6yBaucsyU0+ePZ2vBY/omCWfOaoXZZQtO7WgRVA0DwGrPU7r+S+r9LGkbA oBnw== X-Gm-Message-State: AOJu0YzjVfB63KGqdWLKEvyJ2Gbl/79qmrwAXQQWxJOZWsfwwldm+ocq e3ry94P4w8so5s9fmHHYgAKabDvEoET3fclKuocWLqMPW0XkZTx8XGv04A== X-Google-Smtp-Source: AGHT+IG3/UH7vUu6ESYbPVDvJFpuCPuOLRztSgLFhKtY+/Sj7xlp4J3bcrAx+WB2f7aiKqAwvr5XJQ== X-Received: by 2002:a05:6402:a42:b0:5a2:cc1c:4cf0 with SMTP id 4fb4d7f45d1cf-5b7f36f59ffmr11135474a12.7.1722969462070; Tue, 06 Aug 2024 11:37:42 -0700 (PDT) Received: from pro2.fritz.box (pd9e36fc1.dip0.t-ipconnect.de. [217.227.111.193]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5b83a03b403sm6306992a12.42.2024.08.06.11.37.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Aug 2024 11:37:41 -0700 (PDT) From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#72496: 31.0.50; macOS: freezes without beach ball In-Reply-To: <86wmkto7dh.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 06 Aug 2024 21:04:26 +0300") References: <m2ikwd6a8w.fsf@HIDDEN> <865xsdpusi.fsf@HIDDEN> <m25xsd8v6w.fsf@HIDDEN> <86wmkto7dh.fsf@HIDDEN> Date: Tue, 06 Aug 2024 20:37:40 +0200 Message-ID: <m21q318pl7.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 72496 Cc: 72496 <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 (-) Eli Zaretskii <eliz@HIDDEN> writes: >> From: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> >> Cc: 72496 <at> debbugs.gnu.org >> Date: Tue, 06 Aug 2024 18:36:39 +0200 >>=20 >> I've tried this >>=20 >> (when (fboundp 'ns-app-stop) >> (defun sigusr1-handler () >> (interactive) >> (message "SIGUSR1 - stop event loop") >> (ns-app-stop)) >> (keymap-set special-event-map "<sigusr1>" 'sigusr1-handler)) >>=20 >> where ns-app-stop does such a ns_send_appdefined, but that didn't work >> for a reason unknown to me. > > Maybe the way SIGUSR1 is handled involves the same event queue that is > botched in this scenario? Yes, that's quite likely. I had a little hope that a signal would maybe handled in some special way, but apparently not.
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.Received: (at 72496) by debbugs.gnu.org; 6 Aug 2024 18:04:59 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 06 14:04:59 2024 Received: from localhost ([127.0.0.1]:33005 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sbOYN-0005R8-J4 for submit <at> debbugs.gnu.org; Tue, 06 Aug 2024 14:04:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34282) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1sbOYL-0005Qt-RZ for 72496 <at> debbugs.gnu.org; Tue, 06 Aug 2024 14:04:58 -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 1sbOXs-00021F-Ax; Tue, 06 Aug 2024 14:04:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=sFfsOb1zLcaZBQPB2p/On2+Ih/rlwgJpFB0Psusg074=; b=AMMS8HYtsWn+/q2Mporj oO0gRwpw4CzlgKjiTywA4tehSstNBuEHng+xNXrogyz6HMwH/5EESy/fTpe74ADo2NVudTfeuDL9F M2mvzdXN9p2dgIRJ2boOg8V50fVvj4K3EfaEx8C/JMzb6m+szGpFJ/7IXRWe1NlTpf4UtgE6Zbqvn CrTg8vLhpJD3bA21g1+x5vFTGT8SuXEO2vvqEK+xtEguHC8wtnKHzm5PVlbvtgeeBxcWGKivINq8A g4SY9lagUzWxmoJK4dGsNLtQFCjFEIDJtnfnAXY+ROCnDHdNgkO1ESjGQCn4dXhJUBD7IU1QIDwuo owohNXa3HfXxog==; Date: Tue, 06 Aug 2024 21:04:26 +0300 Message-Id: <86wmkto7dh.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Gerd =?utf-8?Q?M=C3=B6llmann?= <gerd.moellmann@HIDDEN> In-Reply-To: <m25xsd8v6w.fsf@HIDDEN> (message from Gerd =?utf-8?Q?M=C3=B6llmann?= on Tue, 06 Aug 2024 18:36:39 +0200) Subject: Re: bug#72496: 31.0.50; macOS: freezes without beach ball References: <m2ikwd6a8w.fsf@HIDDEN> <865xsdpusi.fsf@HIDDEN> <m25xsd8v6w.fsf@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 72496 Cc: 72496 <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: -3.3 (---) > From: Gerd Möllmann <gerd.moellmann@HIDDEN> > Cc: 72496 <at> debbugs.gnu.org > Date: Tue, 06 Aug 2024 18:36:39 +0200 > > I've tried this > > (when (fboundp 'ns-app-stop) > (defun sigusr1-handler () > (interactive) > (message "SIGUSR1 - stop event loop") > (ns-app-stop)) > (keymap-set special-event-map "<sigusr1>" 'sigusr1-handler)) > > where ns-app-stop does such a ns_send_appdefined, but that didn't work > for a reason unknown to me. Maybe the way SIGUSR1 is handled involves the same event queue that is botched in this scenario?
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.
Received: (at 72496) by debbugs.gnu.org; 6 Aug 2024 16:38:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 06 12:38:13 2024
Received: from localhost ([127.0.0.1]:32960 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1sbNCP-0003Ew-Ju
for submit <at> debbugs.gnu.org; Tue, 06 Aug 2024 12:38:13 -0400
Received: from mail-ed1-f53.google.com ([209.85.208.53]:50220)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <gerd.moellmann@HIDDEN>) id 1sbNCN-0003Ef-Gu
for 72496 <at> debbugs.gnu.org; Tue, 06 Aug 2024 12:38:12 -0400
Received: by mail-ed1-f53.google.com with SMTP id
4fb4d7f45d1cf-5b3fff87e6bso1073436a12.0
for <72496 <at> debbugs.gnu.org>; Tue, 06 Aug 2024 09:37:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1722962201; x=1723567001; darn=debbugs.gnu.org;
h=content-transfer-encoding:mime-version:user-agent:message-id:date
:references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=8p7C8fry4RtiXoa8uOO6Jaa6Z9VFPnx2BMNPYPWvZjY=;
b=YczBWpYar76OJ9OH4/AbIRNL3BesRTF6m4Lq8OCnej7NOY/O6Bv2csEmp2PfiTcML2
LkXPPe1mkAJFWbR6955e1f6buskYpv4fQtfxOWiGoeTjzoOlVzg/J6MxyyzX/B8NCpDN
I1OFFeepdcCMZgNV452wG7GLUeyI8cj4NXu/Pu4nnEymma4n5wSiDQR6KkQdTTwPiP/G
1QaGZN+sDAqlAFto/PdacYsScWB55t4W8SS4XnU1ucRM86PbeQN1M9N1JSsSAgq1r5T7
fExVRlovtl4rwnXEuVtO47tcm98MQgVub/NCrJsr2L+/GZmuNVeb40snCkxNM5Id4pix
ucsQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1722962201; x=1723567001;
h=content-transfer-encoding:mime-version:user-agent:message-id:date
:references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to;
bh=8p7C8fry4RtiXoa8uOO6Jaa6Z9VFPnx2BMNPYPWvZjY=;
b=R0XVyO8W6VB4TxC2CG5iwq+LlWd06bU8qO746/iq/pmybzg1Tb/ZnQJXTNOUoG+FPi
VBamnWaeL7H/eARZIhMNsKLm9VnTE91Ep7JKvXw24rx3XXJHISsNZaPGidrFpU7y0GlE
ImsatZ1Xx39ZGnZojezqb9SAC4Akr3IRJhQApyEFyZUH4rBT0/sShc9hQ68dzhIhDLyz
avf3F9GOkPmDHkEjbUcKmWpAhrSaq6KtyvuYTxxM7VsOfPwXDN9C8CtGMJmzN4E1Jk2u
7JrBHQNRkgSB7Q1VoPkFW7St6NoThXGM6e7hUyb+qiqlQLpj3F/MfKzc5VOYd8Qt6lrA
Gaew==
X-Gm-Message-State: AOJu0YzxzUOzHVFIUiC1j1iYUxl6Pa50sTBe8NGH/4YHeiTt71sreD+4
ocixFNDQACrJVjkV4pxIGuC0P83WCYMV+NJQn60EvxbnJ2WvX/XXHd83Sg==
X-Google-Smtp-Source: AGHT+IHjimZRJ6gFNDVsVNTmxBsTOYZWT3XBtrcad2HIVXfyK3U+eQG64j615PYZmo5WFuvem75Rpw==
X-Received: by 2002:a05:6402:60f:b0:5a3:a9f8:cf20 with SMTP id
4fb4d7f45d1cf-5b7f58eb70dmr10883623a12.34.1722962200850;
Tue, 06 Aug 2024 09:36:40 -0700 (PDT)
Received: from pro2.fritz.box (pd9e36fc1.dip0.t-ipconnect.de.
[217.227.111.193]) by smtp.gmail.com with ESMTPSA id
4fb4d7f45d1cf-5b839708c56sm6129786a12.2.2024.08.06.09.36.40
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 06 Aug 2024 09:36:40 -0700 (PDT)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#72496: 31.0.50; macOS: freezes without beach ball
In-Reply-To: <865xsdpusi.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 06 Aug
2024 17:53:17 +0300")
References: <m2ikwd6a8w.fsf@HIDDEN> <865xsdpusi.fsf@HIDDEN>
Date: Tue, 06 Aug 2024 18:36:39 +0200
Message-ID: <m25xsd8v6w.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72496
Cc: 72496 <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 (-)
Eli Zaretskii <eliz@HIDDEN> writes:
>> From: Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN>
>> Date: Tue, 06 Aug 2024 15:39:43 +0200
>>=20
>> We call [NSApplicaton stop] in our [EmacsApp sendEvent] method. To get
>> there, we post special application-defined events to the application
>> which [NSApplication run] processes and dispatches via sendEvent which
>> calls stop and makes [NSApplication run] return to its caller.
>
> Is there any way to initiate posting that "special application-defined
> event" when Emacs is stuck thusly? For example, from some system
> signal-like event, or from a debugger? Then you at least would have a
> fire escape.
Running under LLDB I can do something, with a little code change in
ns_send_appdefined.
(lldb) expr ns_send_appdefined(-42)
where I let -42 force posting an event, ignoring the global variable I
mentioned, send_appdefined, that prevents the posting. Sometimes I have
to do that twice before Emacs receives key strokes again. And it seems
something is also broken afterwards, for example the cursor stops
blinking, tooltips don't work and such things. But at least one can save
buffers and exit.
I've tried this
(when (fboundp 'ns-app-stop)
(defun sigusr1-handler ()
(interactive)
(message "SIGUSR1 - stop event loop")
(ns-app-stop))
(keymap-set special-event-map "<sigusr1>" 'sigusr1-handler))
where ns-app-stop does such a ns_send_appdefined, but that didn't work
for a reason unknown to me. I also tried to do that in the signal
handler directly, but couldn't make it work either.
BTW, there are also freezes with beach ball, where the situation seems
to be reversed, i.e. for some reason [NSApplication run] seems to no
longer processing events, hence the beach ball. I haven't event a theory
what that could oossibly be caused by.
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.Received: (at 72496) by debbugs.gnu.org; 6 Aug 2024 14:53:52 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 06 10:53:52 2024 Received: from localhost ([127.0.0.1]:32859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sbLZP-0008GT-Qg for submit <at> debbugs.gnu.org; Tue, 06 Aug 2024 10:53:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45806) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1sbLZN-0008GB-NL for 72496 <at> debbugs.gnu.org; Tue, 06 Aug 2024 10:53:50 -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 1sbLYu-0001KA-01; Tue, 06 Aug 2024 10:53:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=BfdCdrGQgFJc3iNgM6NKNM9ZdyRDaSHeihHBfAgXqPk=; b=ddt7/lHprKaJYjE8R9os Gfm6roR8+N0ipL5wujnBeWmXDe6DzOYvQ01Xb/aDRArjS57IABflg5FpH49YQteXCwRWAzL6cgBWQ 4AWzLgN4cWR6dkbjEO1pvhtqSxmmI5OzpZ+k2lWDliCsE9jpkBKD7P2W992W43CjgeYiQFx1oswdv QoyWeaptclPyxbF8vMl4NFDpNeUkxrpUr6tlNBV6+zImlR3T6bkQUq7qoJernCtiZIu8FcoPby0Ga cFun5ZM7Z5AD/vB9jtX5/G35kd5FcDFTTq12e8cpmgAxHVlNv0piDJ6r0gj+BGttU07v75rrwMKJM CtKZp8CFTLYHig==; Date: Tue, 06 Aug 2024 17:53:17 +0300 Message-Id: <865xsdpusi.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Gerd =?utf-8?Q?M=C3=B6llmann?= <gerd.moellmann@HIDDEN> In-Reply-To: <m2ikwd6a8w.fsf@HIDDEN> (message from Gerd =?utf-8?Q?M=C3=B6llmann?= on Tue, 06 Aug 2024 15:39:43 +0200) Subject: Re: bug#72496: 31.0.50; macOS: freezes without beach ball References: <m2ikwd6a8w.fsf@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 72496 Cc: 72496 <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: -3.3 (---) > From: Gerd Möllmann <gerd.moellmann@HIDDEN> > Date: Tue, 06 Aug 2024 15:39:43 +0200 > > We call [NSApplicaton stop] in our [EmacsApp sendEvent] method. To get > there, we post special application-defined events to the application > which [NSApplication run] processes and dispatches via sendEvent which > calls stop and makes [NSApplication run] return to its caller. Is there any way to initiate posting that "special application-defined event" when Emacs is stuck thusly? For example, from some system signal-like event, or from a debugger? Then you at least would have a fire escape.
bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.
Received: (at submit) by debbugs.gnu.org; 6 Aug 2024 13:40:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 06 09:40:17 2024
Received: from localhost ([127.0.0.1]:60464 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1sbKQC-0005pI-JA
for submit <at> debbugs.gnu.org; Tue, 06 Aug 2024 09:40:16 -0400
Received: from lists.gnu.org ([209.51.188.17]:55782)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <gerd.moellmann@HIDDEN>) id 1sbKQA-0005p3-2G
for submit <at> debbugs.gnu.org; Tue, 06 Aug 2024 09:40:14 -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 <gerd.moellmann@HIDDEN>)
id 1sbKPl-0000RX-PZ
for bug-gnu-emacs@HIDDEN; Tue, 06 Aug 2024 09:39:49 -0400
Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from <gerd.moellmann@HIDDEN>)
id 1sbKPk-00076y-0J
for bug-gnu-emacs@HIDDEN; Tue, 06 Aug 2024 09:39:49 -0400
Received: by mail-ed1-x535.google.com with SMTP id
4fb4d7f45d1cf-5af326eddb2so10782544a12.1
for <bug-gnu-emacs@HIDDEN>; Tue, 06 Aug 2024 06:39:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1722951586; x=1723556386; darn=gnu.org;
h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
:date:message-id:reply-to;
bh=yT8IysYloHTeukmTnWln9jS23IlXFQO4Vcw4j26/ZfE=;
b=GtevZgLW4ODXrrq9FYL+GGXY7sv/ap37l2uz+eUPaTQAXthc3uIqzgEamx3UxqSxe3
0bVcKjZDuBSqhL0wNgxWrxRD1GFKpgpsTirzo6sNKln30fWwkzBibRZXMPXWx+BDHRNf
jY8Ypmet5X02i8iSNnoCx7U1yLUgkX3+KEbqYNVabROG9xFgimDHRtr1ghwqVcdBJTLQ
YjLouvL0cplbvqwPVg4664KPNSzXQ4Sf20JANJaLUydt7zvQpgzRyJrX964VvfleN3O8
ft2JjW/FQ166PLZ7mTkHvJsjzGMgWONbqB4rXDTI0R0kSCnDP4Y4dkrHfrAf+6X+WVrk
Vf2A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1722951586; x=1723556386;
h=mime-version:message-id:date:subject:to:from:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=yT8IysYloHTeukmTnWln9jS23IlXFQO4Vcw4j26/ZfE=;
b=izqlmY7+6IR+jZjcsZTO0rbHZy10pdGKCn1Ao40WCCJlJKfY49ifsw4x5TI2OAv+2c
z8ylMw5tYGd3wvIAsqorA2/gVraHlKCupkKYpdEaSO5r9ovbTw32rH5PwA3fygZm0ow6
hJiIgj7yuFM36cruyEkV5s5TM4AEnUf19JvtC3VvbrYvWnzFuoXUGeWIwFCoePDb5CJy
hp0zdbVTQIns6Njq11fkLDdXpMVGthp0KOgQwci/EBVaiWste9eQSoDpSCL3OFBLgjxw
JajgJQ934pSNR7s7QjFgwmUQ6WBIfppzl3ga82/eLxURB4ABVEbYyaAv7POotJoTowln
KIYA==
X-Gm-Message-State: AOJu0YzQoTseE/6n/2s3y3IFXU9ElTwBzqqr3i3j3RlWYaLzTrVniNJL
hN18BZUM6O7mNUVmOOLj+yi0iglxD6qdIG1rd85P4FlHYeUoy8n+Qf80ew==
X-Google-Smtp-Source: AGHT+IGGXTFrXX3bN9CwYAv7M+rnV60KgMlS1iFa5i1jxy5EI9FRCQRnobepui2+mm4EECfkuTRhvw==
X-Received: by 2002:a05:6402:354c:b0:582:7394:a83d with SMTP id
4fb4d7f45d1cf-5b77da8e2f9mr14543490a12.12.1722951585220;
Tue, 06 Aug 2024 06:39:45 -0700 (PDT)
Received: from pro2.fritz.box (pd9e36fc1.dip0.t-ipconnect.de.
[217.227.111.193]) by smtp.gmail.com with ESMTPSA id
4fb4d7f45d1cf-5bb87ea2a79sm2761972a12.35.2024.08.06.06.39.44
for <bug-gnu-emacs@HIDDEN>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 06 Aug 2024 06:39:44 -0700 (PDT)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 31.0.50; macOS: freezes without beach ball
X-Debbugs-Cc:
Date: Tue, 06 Aug 2024 15:39:43 +0200
Message-ID: <m2ikwd6a8w.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2a00:1450:4864:20::535;
envelope-from=gerd.moellmann@HIDDEN; helo=mail-ed1-x535.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: -1.3 (-)
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: -2.3 (--)
In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin23.6.0, NS
appkit-2487.70 Version 14.6 (Build 23G80)) of 2024-08-05 built on
pro2.fritz.box
Repository revision: c7d9cd722e5a7042a52c92f8497f903bfe9870b8
This is one of the problems on macOS that I'm experiencing quite
often. I have no idea what is causing this, and I haven't found a way
to make it reproducible. I guess I should file a bug report anyway.
Let me first try to describe briefly how NS GUI event handling works
in Emacs.
The whole story starts with get_input_pending which calls gobble_input
which calls a terminal's read_socket_hook, which is ns_read_socket in
macOS. ns_read_socket calls [NSApplication run] to process macOS GUI
events.
The problem starts with [NSApplication run] being an endless loop that
gets the next event, and dispatches it by calling the application's
sendEvent method. The only way to make the run loop terminate is by
calling [NSApplication stop]. This sets a flag that [NSApplicatoin
run] is supposed to check and then return, so that we eventually
return to ns_read_socket.
We call [NSApplicaton stop] in our [EmacsApp sendEvent] method. To get
there, we post special application-defined events to the application
which [NSApplication run] processes and dispatches via sendEvent which
calls stop and makes [NSApplication run] return to its caller. Note
that stop only sets a flag, so we need to process another event to
make run terminate. That's at least my understanding.
We are posting these events all over the place, not only before
ns_read_socket calls [NSApplication run]. And, to complicate matters,
whether or not ns_send_appdefined actually posts an event depends on a
global boolean variable. IOW, it's impenetrable.
(I'm also leaving out the generation of input_events for Emacs here,
which is another can of worms.)
Problem is that this not always works. More specifically, this code in
ns_read_socket_1
/* Run and wait for events. We must always send one NX_APPDEFINED event
to ourself, otherwise [NXApp run] will never exit. */
send_appdefined = YES;
ns_send_appdefined (-1);
[NSApp run];
gets stuck in the GUI event loop, and the last line never returns. The
effect being that Emacs freezes without a beach ball of death. It
processes Cocoa events but Emacs never sees any input_events.
Gerd Möllmann <gerd.moellmann@HIDDEN>:bug-gnu-emacs@HIDDEN.
Full text available.bug-gnu-emacs@HIDDEN:bug#72496; Package emacs.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.