diff --git a/Source/NSApplication.m b/Source/NSApplication.m index 2aa36b753..95b07a7bf 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -71,6 +71,12 @@ #include #include +/* Prevent recursion handler */ +static void +_preventRecursion (NSException *exception) +{ +} + /* * Base library exception handler */ @@ -95,12 +101,16 @@ _NSAppKitUncaughtExceptionHandler (NSException *exception) NSSetUncaughtExceptionHandler (defaultUncaughtExceptionHandler); /* - * If there is no graphics context to run the alert panel in, - * use the default exception handler. - */ + * If there is no graphics context to run the alert panel in, just + * quit. */ if (GSCurrentContext() == nil) { - defaultUncaughtExceptionHandler (exception); + _NSUncaughtExceptionHandler = _preventRecursion; + fprintf (stderr, + "Uncaught exception %s, reason: %s\n", + [[exception name] lossyCString], + [[exception reason] lossyCString]); + abort(); } retVal = NSRunCriticalAlertPanel