]> git.eshelyaron.com Git - emacs.git/commitdiff
* nsfns.m (Fns_do_applescript): Put code in the wrong place. Here is correct.
authorJan Djärv <jan.h.d@swipnet.se>
Mon, 26 May 2014 11:26:24 +0000 (13:26 +0200)
committerJan Djärv <jan.h.d@swipnet.se>
Mon, 26 May 2014 11:26:24 +0000 (13:26 +0200)
Fixes: debbugs:17424
src/ChangeLog
src/nsfns.m

index 06f3a9403e380590efa344732555845347b51c10..fd840e0c07bbdcd6942b1f73a14fa8d00764a70f 100644 (file)
@@ -1,5 +1,8 @@
 2014-05-26  Jan Djärv  <jan.h.d@swipnet.se>
 
+       * nsfns.m (Fns_do_applescript): Surround NSApp run
+       with calls to ns_init_events, ns_finish_events (Bug#17424).
+
        * nsterm.h (ns_init_events, ns_finish_events): Declare.
 
        * nsterm.m (ns_init_events, ns_finish_events): New functions.
index 0f2c2e693f7919db640ccd1eecb5576d8360d7be..00a488079c4090c015a0df20404b460bd53f961c 100644 (file)
@@ -2094,10 +2094,8 @@ ns_do_applescript (Lisp_Object script, Lisp_Object *result)
     [[NSAppleScript alloc] initWithSource:
                             [NSString stringWithUTF8String: SSDATA (script)]];
 
-  ns_init_events ();
   returnDescriptor = [scriptObject executeAndReturnError: &errorDict];
   [scriptObject release];
-  ns_finish_events ();
   *result = Qnil;
 
   if (returnDescriptor != NULL)
@@ -2158,6 +2156,7 @@ In case the execution fails, an error is signaled. */)
   Lisp_Object result;
   int status;
   NSEvent *nxev;
+  struct input_event ev;
 
   CHECK_STRING (script);
   check_window_system (NULL);
@@ -2185,8 +2184,10 @@ In case the execution fails, an error is signaled. */)
 
   // If there are other events, the event loop may exit.  Keep running
   // until the script has been handled.  */
+  ns_init_events (&ev);
   while (! NILP (as_script))
     [NSApp run];
+  ns_finish_events ();
 
   status = as_status;
   as_status = 0;