aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Möllmann2024-03-09 15:06:29 +0100
committerGerd Möllmann2024-03-13 07:09:09 +0100
commit4ac4cec652ffaca4333d8f297b8a6c0e5bd79c68 (patch)
tree4d8580e3e86e5d743b24270cc7898dd353ea57da /src
parent6b40d557c4a9a4152565c1a1b0da49a1aaaec84f (diff)
downloademacs-4ac4cec652ffaca4333d8f297b8a6c0e5bd79c68.tar.gz
emacs-4ac4cec652ffaca4333d8f297b8a6c0e5bd79c68.zip
Prevent freezes on macOS (bug#69561)
* src/nsterm.m (ns_select_1): Store pending input_events. Always call [NSApp run].
Diffstat (limited to 'src')
-rw-r--r--src/nsterm.m17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index f094b145fe3..f161edc4ac2 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4739,12 +4739,15 @@ ns_select_1 (int nfds, fd_set *readfds, fd_set *writefds,
4739 check_native_fs (); 4739 check_native_fs ();
4740#endif 4740#endif
4741 4741
4742 if (hold_event_q.nr > 0 && !run_loop_only) 4742 /* If there are input events pending, store them so that Emacs can
4743 recognize C-g. (And we must make sure [NSApp run] is called in
4744 this function, so that C-g has a chance to land in
4745 hold_event_q.) */
4746 if (hold_event_q.nr > 0)
4743 { 4747 {
4744 /* We already have events pending. */ 4748 for (int i = 0; i < hold_event_q.nr; ++i)
4745 raise (SIGIO); 4749 kbd_buffer_store_event_hold (&hold_event_q.q[i], NULL);
4746 errno = EINTR; 4750 hold_event_q.nr = 0;
4747 return -1;
4748 } 4751 }
4749 4752
4750 eassert (nfds <= FD_SETSIZE); 4753 eassert (nfds <= FD_SETSIZE);
@@ -4757,8 +4760,8 @@ ns_select_1 (int nfds, fd_set *readfds, fd_set *writefds,
4757 if (NSApp == nil 4760 if (NSApp == nil
4758 || ![NSThread isMainThread] 4761 || ![NSThread isMainThread]
4759 || (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0)) 4762 || (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0))
4760 return thread_select (pselect, nfds, readfds, writefds, 4763 thread_select (pselect, nfds, readfds, writefds,
4761 exceptfds, timeout, sigmask); 4764 exceptfds, timeout, sigmask);
4762 else 4765 else
4763 { 4766 {
4764 struct timespec t = {0, 0}; 4767 struct timespec t = {0, 0};