aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Reitter2014-11-14 10:56:39 -0500
committerDavid Reitter2014-11-14 18:07:31 -0500
commit658b768a6534ae6e77a8547a56fc31b46b63710b (patch)
tree5cefd3be29069cbb45e3b99cbce4e02ad11e43cd /src
parentf20a19df87444d1977f63dd5b3fc42f4f2d50aa2 (diff)
downloademacs-658b768a6534ae6e77a8547a56fc31b46b63710b.tar.gz
emacs-658b768a6534ae6e77a8547a56fc31b46b63710b.zip
Time-out NS event loop
OS X 10.10 will, at times, not send us the application-defined event that is used to terminate the event loop. As a workaround, we define a timeout and react accordingly. Leaving it in place for other OSX and NS versions as a safety net. Partial revert of 2014-11-08T16:32:37Z!jan.h.d@swipnet.se. Fixes debbugs:18993
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/nsterm.m23
2 files changed, 17 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3bcac1bff33..71b2938694b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12014-11-14 David Reitter <david.reitter@gmail.com>
2
3 * nsterm.m (run): set timeout for event loop to prevent hang.
4 (Bug#18993)
5
12014-11-14 Paul Eggert <eggert@cs.ucla.edu> 62014-11-14 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 * .gitignore: Add emacs-[1-9]*, to ignore files like emacs-25.0.50.1. 8 * .gitignore: Add emacs-[1-9]*, to ignore files like emacs-25.0.50.1.
diff --git a/src/nsterm.m b/src/nsterm.m
index 64951da308f..539f77e512e 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4511,15 +4511,6 @@ ns_term_shutdown (int sig)
4511#ifdef NS_IMPL_COCOA 4511#ifdef NS_IMPL_COCOA
4512- (void)run 4512- (void)run
4513{ 4513{
4514#ifndef NSAppKitVersionNumber10_9
4515#define NSAppKitVersionNumber10_9 1265
4516#endif
4517
4518 if ((int)NSAppKitVersionNumber != NSAppKitVersionNumber10_9)
4519 {
4520 [super run];
4521 return;
4522 }
4523 4514
4524 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 4515 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
4525 4516
@@ -4532,12 +4523,22 @@ ns_term_shutdown (int sig)
4532 [pool release]; 4523 [pool release];
4533 pool = [[NSAutoreleasePool alloc] init]; 4524 pool = [[NSAutoreleasePool alloc] init];
4534 4525
4526 /* OSX 10.10.1 swallows the AppDefined event we are sending ourselves
4527 in certain situations (rapid incoming events).
4528 The timeout we set with untilDate is necessary to prevent a hang.
4529 Bug #18993 */
4530
4535 NSEvent *event = 4531 NSEvent *event =
4536 [self nextEventMatchingMask:NSAnyEventMask 4532 [self nextEventMatchingMask:NSAnyEventMask
4537 untilDate:[NSDate distantFuture] 4533 untilDate:[NSDate dateWithTimeIntervalSinceNow:0.5]
4538 inMode:NSDefaultRunLoopMode 4534 inMode:NSDefaultRunLoopMode
4539 dequeue:YES]; 4535 dequeue:YES];
4540 [self sendEvent:event]; 4536
4537 if (event == nil) // timeout
4538 shouldKeepRunning = NO;
4539 else
4540 [self sendEvent:event];
4541
4541 [self updateWindows]; 4542 [self updateWindows];
4542 } while (shouldKeepRunning); 4543 } while (shouldKeepRunning);
4543 4544