diff options
Diffstat (limited to 'indra/newview/llappdelegate-objc.mm')
| -rw-r--r-- | indra/newview/llappdelegate-objc.mm | 65 | 
1 files changed, 65 insertions, 0 deletions
| diff --git a/indra/newview/llappdelegate-objc.mm b/indra/newview/llappdelegate-objc.mm index aebae4c434..82e49540a4 100644 --- a/indra/newview/llappdelegate-objc.mm +++ b/indra/newview/llappdelegate-objc.mm @@ -25,7 +25,14 @@   */  #import "llappdelegate-objc.h" +#if defined(LL_BUGSPLAT) +@import BugsplatMac; +// derived from BugsplatMac's BugsplatTester/AppDelegate.m +@interface LLAppDelegate () <BugsplatStartupManagerDelegate> +@end +#endif  #include "llwindowmacosx-objc.h" +#include "llappviewermacosx-for-objc.h"  #include <Carbon/Carbon.h> // Used for Text Input Services ("Safe" API - it's supported)  @implementation LLAppDelegate @@ -64,6 +71,14 @@  	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(languageUpdated) name:@"NSTextInputContextKeyboardSelectionDidChangeNotification" object:nil];   //   [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; + +#if defined(LL_BUGSPLAT) +	// https://www.bugsplat.com/docs/platforms/os-x#initialization +	[BugsplatStartupManager sharedManager].autoSubmitCrashReport = YES; +	[BugsplatStartupManager sharedManager].askUserDetails = NO; +	[BugsplatStartupManager sharedManager].delegate = self; +	[[BugsplatStartupManager sharedManager] start]; +#endif  }  - (void) handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent { @@ -179,4 +194,54 @@      return true;  } +#if defined(LL_BUGSPLAT) + +- (NSString *)applicationLogForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager +{ +    infos("Reached applicationLogForBugsplatStartupManager"); +    // Apparently this override method only contributes the User Description +    // field of BugSplat's All Crashes table. Despite the method name, it +    // would seem to be a bad place to try to stuff all of SecondLife.log. +    return [NSString stringWithCString:getFatalMessage().c_str() +                              encoding:NSUTF8StringEncoding]; +} + +- (void)bugsplatStartupManagerWillSendCrashReport:(BugsplatStartupManager *)bugsplatStartupManager +{ +    infos("Reached bugsplatStartupManagerWillSendCrashReport"); +} + +- (BugsplatAttachment *)attachmentForBugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager { +    // We get the *old* log file pathname (for SecondLife.old) because it's on +    // the run *following* the crash that BugsplatStartupManager notices that +    // the previous run crashed and calls this override. By that time, we've +    // already renamed SecondLife.log to SecondLife.old. +    std::string logfile = getOldLogFilePathname(); +    NSString *ns_logfile = [NSString stringWithCString:logfile.c_str() +                                              encoding:NSUTF8StringEncoding]; +    NSData *data = [NSData dataWithContentsOfFile:ns_logfile]; + +    // Apologies for the hard-coded log-file basename, but I do not know the +    // incantation for "$(basename "$logfile")" in this language. +    BugsplatAttachment *attachment =  +        [[BugsplatAttachment alloc] initWithFilename:@"SecondLife.log" +                                      attachmentData:data +                                         contentType:@"text/plain"]; +    infos("attachmentForBugsplatStartupManager: attaching " + logfile); +    return attachment; +} + +- (void)bugsplatStartupManagerDidFinishSendingCrashReport:(BugsplatStartupManager *)bugsplatStartupManager +{ +    infos("Sent crash report to BugSplat"); +} + +- (void)bugsplatStartupManager:(BugsplatStartupManager *)bugsplatStartupManager didFailWithError:(NSError *)error +{ +    // TODO: message string from NSError +    infos("Could not send crash report to BugSplat"); +} + +#endif // LL_BUGSPLAT +  @end | 
