Subject: bug#69561: 30.0.50; Freeze from M-x gnus on macOS

From: Gerd Möllmann <[email-masked]>
Date: Wed, 13 Mar 2024 19:20:17 +0100

Filipp Gunbin <[email-masked]> writes:

> On 13/03/2024 07:11 +0100, Gerd Möllmann wrote:
>
>> Pushed to mater and closing.
>
> (I haven't read this thread in detail) On TTY there were no freezes
> before the patch, but now there are - for example, `C-x v L' in emacs
> repo freezes.
>
> Thanks.

Thanks, Filipp. Could you please try the attached patch?

But - are you sure you see a freeze, i.e. you can't, don't know, C-x C-c
or C-g or whatever else? That's not what I see with emacs -nw -Q, I see
an empty log window.

diff --git a/src/nsterm.m b/src/nsterm.m
index f161edc4ac2..97d6329cf4b 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4757,9 +4757,11 @@ Function modeled after x_draw_glyph_string_box ().
       if (writefds && FD_ISSET(k, writefds)) ++nr;
     }
 
-  if (NSApp == nil
-      || ![NSThread isMainThread]
-      || (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0))
+  if (NSApp == nil)
+    return thread_select (pselect, nfds, readfds, writefds,
+			  exceptfds, timeout, sigmask);
+  else if (![NSThread isMainThread]
+	   || (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0))
     thread_select (pselect, nfds, readfds, writefds,
 		   exceptfds, timeout, sigmask);
   else