mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 01:01:03 +00:00
Fix buggy behavior where if the uncaught exception handler was set to a
function which returned, the -raise method could return. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21389 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f60e075ac5
commit
59fed7cd35
3 changed files with 85 additions and 35 deletions
|
@ -6,6 +6,12 @@
|
|||
|
||||
#if 1
|
||||
|
||||
static void uncaught(NSException* e)
|
||||
{
|
||||
fprintf(stderr, "In uncaught exception handler.\n");
|
||||
[NSException raise: NSGenericException format: @"Recursive exception"];
|
||||
}
|
||||
|
||||
static void test1(void)
|
||||
{
|
||||
NSURL *baseURL = [NSURL fileURLWithPath:@"/usr/local/bin"];
|
||||
|
@ -138,7 +144,15 @@ int main ()
|
|||
|
||||
printf ("Hello from object at 0x%x\n", (unsigned)[o self]);
|
||||
|
||||
NSLog(@"Value for foo is %@", [a valueForKey: @"foo"]);
|
||||
NS_DURING
|
||||
{
|
||||
NSLog(@"Value for foo is %@", [a valueForKey: @"foo"]);
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"Caught expected exception: %@", localException);
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
[o release];
|
||||
o = [NSString stringWithFormat: @"/proc/%d/status", getpid()];
|
||||
|
@ -146,6 +160,10 @@ int main ()
|
|||
o = [NSString stringWithContentsOfFile: o];
|
||||
NSLog(@"'%@'", o);
|
||||
|
||||
NSLog(@"This test should now cause program termination after a recursive exception");
|
||||
|
||||
NSSetUncaughtExceptionHandler(uncaught);
|
||||
[NSException raise: NSGenericException format: @"an artifical exception"];
|
||||
exit (0);
|
||||
}
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue