Commit 08f27aa3 authored by Jan Djärv's avatar Jan Djärv
Browse files

* nsterm.m (ns_select, ns_read_socket): Use unwind_protect to decrease

apploopnr.

Fixes: debbugs:18345
parent 47232a2f
......@@ -2,6 +2,8 @@
 
* nsterm.m (syms_of_nsterm): ns-use-fullscreen-animation is new.
(toggleFullScreen:): Use ns-use-fullscreen-animation for animate.
(ns_select, ns_read_socket): Use unwind_protect to decrease
apploopnr (Bug#18345).
 
* macfont.m: Fix indentation and import changes from macport
24.3.94.
......
......@@ -3513,6 +3513,15 @@ overwriting cursor (usually when cursor on a tab) */
}
#endif /* NS_IMPL_COCOA) && >= MAC_OS_X_VERSION_10_5 */
static void
unwind_apploopnr (Lisp_Object not_used)
{
--apploopnr;
n_emacs_events_pending = 0;
ns_finish_events ();
q_event_ptr = NULL;
}
static int
ns_read_socket (struct terminal *terminal, struct input_event *hold_quit)
/* --------------------------------------------------------------------------
......@@ -3570,6 +3579,7 @@ overwriting cursor (usually when cursor on a tab) */
}
else
{
ptrdiff_t specpdl_count = SPECPDL_INDEX ();
/* Run and wait for events. We must always send one NX_APPDEFINED event
to ourself, otherwise [NXApp run] will never exit. */
send_appdefined = YES;
......@@ -3579,8 +3589,9 @@ overwriting cursor (usually when cursor on a tab) */
{
emacs_abort ();
}
record_unwind_protect (unwind_apploopnr, Qt);
[NSApp run];
--apploopnr;
unbind_to (specpdl_count, Qnil); /* calls unwind_apploopnr */
}
nevents = n_emacs_events_pending;
......@@ -3687,8 +3698,14 @@ overwriting cursor (usually when cursor on a tab) */
{
emacs_abort ();
}
[NSApp run];
--apploopnr;
{
ptrdiff_t specpdl_count = SPECPDL_INDEX ();
record_unwind_protect (unwind_apploopnr, Qt);
[NSApp run];
unbind_to (specpdl_count, Qnil); /* calls unwind_apploopnr */
}
ns_finish_events ();
if (nr > 0 && readfds)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment