Implemented AppKit exception handler

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@7598 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Lyndon Tremblay 2000-09-26 09:01:58 +00:00
parent a22296f346
commit 5f2683a975
3 changed files with 44 additions and 1 deletions

View file

@ -1,3 +1,15 @@
2000-09-26 Lyndon Tremblay <humasect@home.com>
* Source/NSApplication.m ([NSApplication +initialize]): Override
Foundation's uncaught exception handler.
* Headers/AppKit/NSPanel.h (NSAlert*): #defines to comply
with MacOS X [apparently].
* Source/NSApplication.m (_NSAppKitUncaughtExceptionHandler): Added
to show unhandled exceptions to the user in a cleaner way,
providing an option to ignore or debug [future use].
Tue Sep 26 09:36:07 2000 Nicola Pero <nicola@brainstorm.co.uk>
* NSControl.m ([-copyWithZone:]): Fixed memory problem (found

View file

@ -43,7 +43,12 @@ enum {
NSAlertAlternateReturn = 0,
NSAlertOtherReturn = -1,
NSAlertErrorReturn = -2
};
};
// from MacOS X docs
#define NSAlertDefault NSAlertDefaultReturn
#define NSAlertAlternate NSAlertAlternateReturn
#define NSAlertOther NSAlertOtherReturn
#ifndef STRICT_OPENSTEP
#define NS_ALERTDEFAULT NSAlertDefaultReturn

View file

@ -68,6 +68,29 @@
#include <AppKit/IMLoading.h>
#include <AppKit/DPSOperators.h>
/*
* AppKit exception handler (overrides Foundation)
*/
static void
_NSAppKitUncaughtExceptionHandler (NSException *exception)
{
int retVal;
#ifdef DEBUG
#define DEBUG_BUTTON @"Debug"
#else
#define DEBUG_BUTTON nil
#endif
retVal = NSRunCriticalAlertPanel([[NSProcessInfo processInfo] processName],
@"%@: %@",
@"Abort", @"Ignore", DEBUG_BUTTON,
[exception name], [exception reason]);
if (retVal == NSAlertDefault)
abort();
}
/*
* Types
*/
@ -250,6 +273,9 @@ static NSCell* tileCell = nil;
* can prevent -release loops
*/
gnustep_gui_app_is_in_dealloc = NO;
// Set the AppKit exception handler.
_NSUncaughtExceptionHandler = _NSAppKitUncaughtExceptionHandler;
}
}