bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #23314] Problem handling exceptions with own handler


From: UBoss
Subject: [bug #23314] Problem handling exceptions with own handler
Date: Wed, 21 May 2008 12:04:29 +0000
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.8) Gecko/20051130 Firefox/1.5

URL:
  <http://savannah.gnu.org/bugs/?23314>

                 Summary: Problem handling exceptions with own handler
                 Project: GNUstep
            Submitted by: uboss
            Submitted on: Wednesday 05/21/2008 at 12:04
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

When instaled own handler

static void myExceptionHandler (NSException *exception)
{
    FILE *fw;                   
    NSLog (@"Osetruji exception ...\n%@", exception);
    fw = fopen ("exception.err", "a");
    fprintf (fw, [[NSString stringWithFormat:@"%@ -> ERROR:\n%@\n", [NSDate
date], exception] cString]);
    fclose (fw);
    abort ();                   
}

with

     NSSetUncaughtExceptionHandler(&myExceptionHandler);

or 

    _NSUncaughtExceptionHandler = myExceptionHandler;   

and then call

    [NSException raise:NSInternalInconsistencyException
                format:@"TEST TEST TEST"];

the handler myExceptionHandler is not called, 
insted of message 
 Osetruji exception ...
<NSException: 0x8540070> NAME:NSInternalInconsistencyException REASON:TEST
TEST TEST INFO:(nil)
Abort (core dumped)

I got mesasge 
Problem posting notification: <NSException: 0                                
    x85400f0> NAME:NSInternalInconsistencyException REASON:TEST TEST TEST
INFO:(nil)

it has something to do with NSNotificationCeneter.m _postAndRelease method 

...
      if (o->next != 0)
        {
         NS_DURING
            {
              (*o->method)(o->observer, o->selector, notification);
            }
          NS_HANDLER
            {
              NSLog(@"Problem posting notification: %@", localException);
            }
          NS_ENDHANDLER
...

when removed NS_DURING and NS_HANDLER ... NS_ENDHANDLER

the handler myExceptionHandler is called again.









    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?23314>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]