Commit 658b768a authored by David Reitter's avatar David Reitter
Browse files

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!

Fixes debbugs:18993
parent f20a19df
2014-11-14 David Reitter <>
* nsterm.m (run): set timeout for event loop to prevent hang.
2014-11-14 Paul Eggert <>
* .gitignore: Add emacs-[1-9]*, to ignore files like emacs-
......@@ -4511,15 +4511,6 @@ - (id)init
- (void)run
#ifndef NSAppKitVersionNumber10_9
#define NSAppKitVersionNumber10_9 1265
if ((int)NSAppKitVersionNumber != NSAppKitVersionNumber10_9)
[super run];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
......@@ -4532,12 +4523,22 @@ - (void)run
[pool release];
pool = [[NSAutoreleasePool alloc] init];
/* OSX 10.10.1 swallows the AppDefined event we are sending ourselves
in certain situations (rapid incoming events).
The timeout we set with untilDate is necessary to prevent a hang.
Bug #18993 */
NSEvent *event =
[self nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantFuture]
untilDate:[NSDate dateWithTimeIntervalSinceNow:0.5]
[self sendEvent:event];
if (event == nil) // timeout
shouldKeepRunning = NO;
[self sendEvent:event];
[self updateWindows];
} while (shouldKeepRunning);
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