emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r118051: * nsterm.m (ns_select, ns_read_socket): Use


From: Jan D.
Subject: [Emacs-diffs] trunk r118051: * nsterm.m (ns_select, ns_read_socket): Use unwind_protect to decrease
Date: Sun, 05 Oct 2014 14:17:47 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 118051
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/18345
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Sun 2014-10-05 16:17:43 +0200
message:
  * nsterm.m (ns_select, ns_read_socket): Use unwind_protect to decrease
  apploopnr.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/nsterm.m                   nsterm.m-20091113204419-o5vbwnq5f7feedwu-8747
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-10-05 12:20:17 +0000
+++ b/src/ChangeLog     2014-10-05 14:17:43 +0000
@@ -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.

=== modified file 'src/nsterm.m'
--- a/src/nsterm.m      2014-10-05 12:20:17 +0000
+++ b/src/nsterm.m      2014-10-05 14:17:43 +0000
@@ -3513,6 +3513,15 @@
 }
 #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 @@
     }
   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 @@
         {
           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 @@
     {
       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)
     {


reply via email to

[Prev in Thread] Current Thread [Next in Thread]