Index: Source/NSApplication.m =================================================================== --- Source/NSApplication.m (revision 27805) +++ Source/NSApplication.m (working copy) @@ -126,6 +126,7 @@ [exception raise]; } + /* retVal = GSRunExceptionPanel ([NSString stringWithFormat: _(@"Critical Error in %@"), [[NSProcessInfo processInfo] processName]], @@ -137,18 +138,19 @@ #else nil); #endif + */ /* The user wants to abort */ if (retVal == NSAlertDefault) { /* The following will raise again the exception using the base library exception handler */ - [exception raise]; + // [exception raise]; } else { /* Debug button: abort so we can trace the error in gdb */ - abort(); + // abort(); } } @@ -1378,7 +1380,8 @@ { NSEvent *e; id distantFuture = [NSDate distantFuture]; /* Cache this, safe */ - + BOOL debug = [[NSUserDefaults standardUserDefaults] boolForKey: @"GSDebugException"]; + if (_runLoopPool != nil) { [NSException raise: NSInternalInconsistencyException @@ -1409,16 +1412,31 @@ IF_NO_GC(_runLoopPool = [arpClass new]); e = [self nextEventMatchingMask: NSAnyEventMask - untilDate: distantFuture - inMode: NSDefaultRunLoopMode - dequeue: YES]; - + untilDate: distantFuture + inMode: NSDefaultRunLoopMode + dequeue: YES]; + if (e != nil && e != null_event) { NSEventType type = [e type]; - - [self sendEvent: e]; - + NS_DURING + { + [self sendEvent: e]; + } + NS_HANDLER + { + if(debug) + { + [localException raise]; + } + else + { + NSLog(@"NSApplication caught an unhandled exception: %@", + localException); + } + } + NS_ENDHANDLER; + // update (en/disable) the services menu's items if (type != NSPeriodic && type != NSMouseMoved) { @@ -1426,7 +1444,7 @@ [_main_menu update]; } } - + DESTROY (_runLoopPool); }