• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Crashing on all relevant exceptions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crashing on all relevant exceptions


  • Subject: Re: Crashing on all relevant exceptions
  • From: Shaun Wexler <email@hidden>
  • Date: Mon, 7 Aug 2006 17:28:27 -0700

On Aug 7, 2006, at 1:48 PM, Aaron Jacobs wrote:

This will correctly cause the program to die if an exception is raised, even if it happens during the processing of an event. However, it causes the program to just quit with an exit status of zero, which doesn't indicate to the system that it has crashed, so e.g. the crash reporter window doesn't come up.

If I uncomment the line that re-raises the exception, then the program correctly crashes. However, the crash report indicates that it happened at that line in the run method, rather than on the line that initially raised the exception. I would rather have a crash report giving a correct stack trace.

Does anyone know how to get around this problem?

I'm actually surprised that code even works as well as it does -- shouldn't NSApplication's own exception handler be nested deeper than that and thus take priority? Maybe it doesn't install an exception handler if there's already an existing one? Does anyone know why this works?


static void MyUncaughtExceptionHandler(NSException *exception)
{
    // handle the exception
}

int main(int argc, char *argv[])
{
    NSSetUncaughtExceptionHandler(MyUncaughtExceptionHandler);
    return NSApplicationMain(argc, (const char **)argv);
}

As a side note, CFRunLoop/NSRunLoop leaks a 16-byte memory allocation for every uncaught exception within its callouts. <rdar://problem/ 4670839>
--
Shaun Wexler
MacFOH
http://www.macfoh.com


Good code doesn't throw exceptions.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Crashing on all relevant exceptions
      • From: Aaron Jacobs <email@hidden>
    • Re: Crashing on all relevant exceptions
      • From: Nick Zitzmann <email@hidden>
References: 
 >Crashing on all relevant exceptions (From: Aaron Jacobs <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Nick Zitzmann <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Aaron Jacobs <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Nick Zitzmann <email@hidden>)
 >Re: Crashing on all relevant exceptions (From: Aaron Jacobs <email@hidden>)

  • Prev by Date: Finding moved files by file descriptor or inode
  • Next by Date: Re: Finding moved files by file descriptor or inode
  • Previous by thread: Re: Crashing on all relevant exceptions
  • Next by thread: Re: Crashing on all relevant exceptions
  • Index(es):
    • Date
    • Thread