mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Add uncaught exception handler for native objc exceptions
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27168 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
908370d2fd
commit
1459f45289
7 changed files with 7316 additions and 7395 deletions
|
@ -724,17 +724,31 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
|
|||
_terminate();
|
||||
}
|
||||
|
||||
static void
|
||||
callUncaughtHandler(id value)
|
||||
{
|
||||
if (_NSUncaughtExceptionHandler != NULL)
|
||||
{
|
||||
(*_NSUncaughtExceptionHandler)(value);
|
||||
}
|
||||
_NSFoundationUncaughtExceptionHandler(value);
|
||||
}
|
||||
|
||||
@implementation NSException
|
||||
|
||||
#if defined(STACKSYMBOLS)
|
||||
+ (void) initialize
|
||||
{
|
||||
#if defined(STACKSYMBOLS)
|
||||
if (modLock == nil)
|
||||
{
|
||||
modLock = [NSRecursiveLock new];
|
||||
}
|
||||
}
|
||||
#endif /* STACKSYMBOLS */
|
||||
#if defined(_NATIVE_OBJC_EXCEPTIONS) && defined(HAVE_UNEXPECTED)
|
||||
objc_set_unexpected(callUncaughtHandler);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
+ (NSException*) exceptionWithName: (NSString*)name
|
||||
reason: (NSString*)reason
|
||||
|
@ -850,10 +864,7 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
|
|||
/*
|
||||
* Call the uncaught exception handler (if there is one).
|
||||
*/
|
||||
if (_NSUncaughtExceptionHandler != NULL)
|
||||
{
|
||||
(*_NSUncaughtExceptionHandler)(self);
|
||||
}
|
||||
callUncaughtHandler(self);
|
||||
|
||||
/*
|
||||
* The uncaught exception handler which is set has not
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue