diff options
| author | Jan Djärv | 2014-10-05 16:17:43 +0200 |
|---|---|---|
| committer | Jan Djärv | 2014-10-05 16:17:43 +0200 |
| commit | 08f27aa39c498d34418c7420b33bf2db913827c3 (patch) | |
| tree | 9793e3d73eb54221a2ae2220fd1bf393c941a2e4 /src | |
| parent | 47232a2faa0082a48d2b72c9f8ae1a6ca47c5d54 (diff) | |
| download | emacs-08f27aa39c498d34418c7420b33bf2db913827c3.tar.gz emacs-08f27aa39c498d34418c7420b33bf2db913827c3.zip | |
* nsterm.m (ns_select, ns_read_socket): Use unwind_protect to decrease
apploopnr.
Fixes: debbugs:18345
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 2 | ||||
| -rw-r--r-- | src/nsterm.m | 23 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index fe0077b92b5..77494c0dc42 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | * nsterm.m (syms_of_nsterm): ns-use-fullscreen-animation is new. | 3 | * nsterm.m (syms_of_nsterm): ns-use-fullscreen-animation is new. |
| 4 | (toggleFullScreen:): Use ns-use-fullscreen-animation for animate. | 4 | (toggleFullScreen:): Use ns-use-fullscreen-animation for animate. |
| 5 | (ns_select, ns_read_socket): Use unwind_protect to decrease | ||
| 6 | apploopnr (Bug#18345). | ||
| 5 | 7 | ||
| 6 | * macfont.m: Fix indentation and import changes from macport | 8 | * macfont.m: Fix indentation and import changes from macport |
| 7 | 24.3.94. | 9 | 24.3.94. |
diff --git a/src/nsterm.m b/src/nsterm.m index 6e25716b239..332b7cc0b78 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -3513,6 +3513,15 @@ ns_check_pending_open_menu () | |||
| 3513 | } | 3513 | } |
| 3514 | #endif /* NS_IMPL_COCOA) && >= MAC_OS_X_VERSION_10_5 */ | 3514 | #endif /* NS_IMPL_COCOA) && >= MAC_OS_X_VERSION_10_5 */ |
| 3515 | 3515 | ||
| 3516 | static void | ||
| 3517 | unwind_apploopnr (Lisp_Object not_used) | ||
| 3518 | { | ||
| 3519 | --apploopnr; | ||
| 3520 | n_emacs_events_pending = 0; | ||
| 3521 | ns_finish_events (); | ||
| 3522 | q_event_ptr = NULL; | ||
| 3523 | } | ||
| 3524 | |||
| 3516 | static int | 3525 | static int |
| 3517 | ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) | 3526 | ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) |
| 3518 | /* -------------------------------------------------------------------------- | 3527 | /* -------------------------------------------------------------------------- |
| @@ -3570,6 +3579,7 @@ ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 3570 | } | 3579 | } |
| 3571 | else | 3580 | else |
| 3572 | { | 3581 | { |
| 3582 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); | ||
| 3573 | /* Run and wait for events. We must always send one NX_APPDEFINED event | 3583 | /* Run and wait for events. We must always send one NX_APPDEFINED event |
| 3574 | to ourself, otherwise [NXApp run] will never exit. */ | 3584 | to ourself, otherwise [NXApp run] will never exit. */ |
| 3575 | send_appdefined = YES; | 3585 | send_appdefined = YES; |
| @@ -3579,8 +3589,9 @@ ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) | |||
| 3579 | { | 3589 | { |
| 3580 | emacs_abort (); | 3590 | emacs_abort (); |
| 3581 | } | 3591 | } |
| 3592 | record_unwind_protect (unwind_apploopnr, Qt); | ||
| 3582 | [NSApp run]; | 3593 | [NSApp run]; |
| 3583 | --apploopnr; | 3594 | unbind_to (specpdl_count, Qnil); /* calls unwind_apploopnr */ |
| 3584 | } | 3595 | } |
| 3585 | 3596 | ||
| 3586 | nevents = n_emacs_events_pending; | 3597 | nevents = n_emacs_events_pending; |
| @@ -3687,8 +3698,14 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, | |||
| 3687 | { | 3698 | { |
| 3688 | emacs_abort (); | 3699 | emacs_abort (); |
| 3689 | } | 3700 | } |
| 3690 | [NSApp run]; | 3701 | |
| 3691 | --apploopnr; | 3702 | { |
| 3703 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); | ||
| 3704 | record_unwind_protect (unwind_apploopnr, Qt); | ||
| 3705 | [NSApp run]; | ||
| 3706 | unbind_to (specpdl_count, Qnil); /* calls unwind_apploopnr */ | ||
| 3707 | } | ||
| 3708 | |||
| 3692 | ns_finish_events (); | 3709 | ns_finish_events (); |
| 3693 | if (nr > 0 && readfds) | 3710 | if (nr > 0 && readfds) |
| 3694 | { | 3711 | { |