Hey Julian, for masochists like me who are mixing cocoa and juce would you consider the following?
This’ll catch any appkit exceptions and give me a chance to log them.
[code]
void MessageManager::runDispatchLoop()
{
if (! quitMessagePosted) // check that the quit message wasn’t already posted…
{
const ScopedAutoReleasePool pool;
// must only be called by the message thread!
jassert (isThisTheMessageThread());
@try {
[NSApp run];
}
@catch (NSException * e) {
// called if AppKit throws an exception.
// application will exit after this...but at least you have a chance to log the exception.
// We will always have a JUCEApplication instance...
std::runtime_error ex(std::string("Appkit/Cocoa exception. Name:") + [[e name]UTF8String] + " Reason:" + [[e reason]UTF8String] );
JUCEApplication::getInstance()->unhandledException (&ex, __FILE__, __LINE__);
}
@finally {
}
}
}[/code]
If you want to test, throw this in a .mm function that the main runloop can call into…
[[NSException exceptionWithName:@“Exception Name” reason:@“Exception Reason” userInfo:nil]raise];
or
[NSDictionary dictionaryWithObject:nil forKey:@“CRASH!”];
(gives me at least this…)