Log exceptions when timer fires

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20025 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-09-07 16:54:16 +00:00
parent 5f8b76348f
commit 199542334a
2 changed files with 25 additions and 2 deletions

View file

@ -4,6 +4,7 @@
* Source/GSSet.m: ([allObjects]) Fix stack overflow for large sets. * Source/GSSet.m: ([allObjects]) Fix stack overflow for large sets.
* Source/NSTask.m: Fix error testing for task which has been lost. * Source/NSTask.m: Fix error testing for task which has been lost.
* Source/NSArray.m: Fix possible stack overflows * Source/NSArray.m: Fix possible stack overflows
* Source/NSTimer.m: Log uncaught exceptions when timer fires.
Thanks to Andre Levey for reporting these. Thanks to Andre Levey for reporting these.
2004-09-07 Richard Frith-Macdonald <rfm@gnu.org> 2004-09-07 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -195,13 +195,35 @@ static Class NSDate_class;
- (void) fire - (void) fire
{ {
if (_selector == 0) if (_selector == 0)
{
NS_DURING
{ {
[(NSInvocation*)_target invoke]; [(NSInvocation*)_target invoke];
} }
NS_HANDLER
{
NSLog(@"*** NSTimer ignoring exception '%@' (reason '%@') "
@"raised during posting of timer with target %p and selector '%@'",
[localException name], [localException reason], _target,
NSStringFromSelector([_target selector]));
}
NS_ENDHANDLER
}
else else
{
NS_DURING
{ {
[_target performSelector: _selector withObject: self]; [_target performSelector: _selector withObject: self];
} }
NS_HANDLER
{
NSLog(@"*** NSTimer ignoring exception '%@' (reason '%@') "
@"raised during posting of timer with target %p and selector '%@'",
[localException name], [localException reason], _target,
NSStringFromSelector(_selector));
}
NS_ENDHANDLER
}
if (_repeats == NO) if (_repeats == NO)
{ {