recover from exception on iOS and macOS using signals and log the stacktrace

This commit is contained in:
2018-10-04 15:26:18 +02:00
parent f45eefe433
commit 55dbab498f
7 changed files with 53 additions and 64 deletions

View File

@@ -11,22 +11,6 @@
#include "app.h"
#include <WTSonarPenDriver.h>
void global_exception_handler(NSException* e)
{
if (App::I.canvas && App::I.canvas->m_canvas)
App::I.canvas->m_canvas->project_save_thread(App::I.data_path + "/recovery.ppi");
std::terminate();
}
void global_signal_handler(int e)
{
if (App::I.canvas && App::I.canvas->m_canvas)
App::I.canvas->m_canvas->project_save_thread(App::I.data_path + "/recovery.ppi");
std::terminate();
}
@interface AppDelegate () {
GameViewController* view;
WTSonarPenDriver* sonarpen_driver;
@@ -68,8 +52,6 @@ void global_signal_handler(int e)
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
NSSetUncaughtExceptionHandler(&global_exception_handler);
// sonarpen_driver = [[WTSonarPenDriver alloc] initWithApplication:application];
// [sonarpen_driver start];
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(penStatusChanged) name:WTSonarPenDriverStateChangedNotification object:nil];

View File

@@ -8,8 +8,10 @@
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
#include "objc_utils.h"
int main(int argc, char * argv[]) {
install_global_handlers();
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}