update iOS project
This commit is contained in:
@@ -41,14 +41,9 @@
|
||||
|
||||
std::string base_address;
|
||||
std::atomic_flag handler_executed;
|
||||
void exception_handler(NSException *exception)
|
||||
|
||||
void save_recovery()
|
||||
{
|
||||
if (handler_executed.test_and_set())
|
||||
exit(0);
|
||||
LOG("exception %s\n", [[exception name] cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
NSString* callstack = [[NSThread callStackSymbols] componentsJoinedByString:@"\n"];
|
||||
LOG("base:\n%s\ncallstack:\n%s", base_address.c_str(), [callstack cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
|
||||
auto t = std::time(nullptr);
|
||||
auto tm = *std::localtime(&t);
|
||||
std::ostringstream oss;
|
||||
@@ -57,6 +52,16 @@ void exception_handler(NSException *exception)
|
||||
|
||||
if (App::I->canvas && App::I->canvas->m_canvas)
|
||||
App::I->canvas->m_canvas->project_save_thread(path);
|
||||
}
|
||||
|
||||
void exception_handler(NSException *exception)
|
||||
{
|
||||
if (handler_executed.test_and_set())
|
||||
exit(0);
|
||||
LOG("exception %s\n", [[exception name] cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
NSString* callstack = [[NSThread callStackSymbols] componentsJoinedByString:@"\n"];
|
||||
LOG("base:\n%s\ncallstack:\n%s", base_address.c_str(), [callstack cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
save_recovery();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -66,15 +71,19 @@ static void signal_handler (int signo) {
|
||||
LOG("signal %d\n", signo);
|
||||
NSString* callstack = [[NSThread callStackSymbols] componentsJoinedByString:@"\n"];
|
||||
LOG("base:\n%s\ncallstack:\n%s", base_address.c_str(), [callstack cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
save_recovery();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
auto t = std::time(nullptr);
|
||||
auto tm = *std::localtime(&t);
|
||||
std::ostringstream oss;
|
||||
oss << std::put_time(&tm, "%d-%m-%Y %H-%M-%S");
|
||||
auto path = App::I->data_path + "/" + App::I->doc_name + "-recovery (" + oss.str() + ").ppi";
|
||||
void SignalHandler(int sig, siginfo_t *info, void *context)
|
||||
{
|
||||
save_recovery();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (App::I->canvas && App::I->canvas->m_canvas)
|
||||
App::I->canvas->m_canvas->project_save_thread(path);
|
||||
void TerminateHandler()
|
||||
{
|
||||
save_recovery();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -89,4 +98,27 @@ void install_global_handlers()
|
||||
signal(SIGFPE, signal_handler);
|
||||
signal(SIGBUS, signal_handler);
|
||||
signal(SIGPIPE, signal_handler);
|
||||
|
||||
/*
|
||||
struct sigaction mySigAction;
|
||||
mySigAction.sa_sigaction = SignalHandler;
|
||||
mySigAction.sa_flags = SA_SIGINFO;
|
||||
|
||||
sigemptyset(&mySigAction.sa_mask);
|
||||
sigaction(SIGQUIT, &mySigAction, NULL);
|
||||
sigaction(SIGILL, &mySigAction, NULL);
|
||||
sigaction(SIGTRAP, &mySigAction, NULL);
|
||||
sigaction(SIGABRT, &mySigAction, NULL);
|
||||
sigaction(SIGEMT, &mySigAction, NULL);
|
||||
sigaction(SIGFPE, &mySigAction, NULL);
|
||||
sigaction(SIGBUS, &mySigAction, NULL);
|
||||
sigaction(SIGSEGV, &mySigAction, NULL);
|
||||
sigaction(SIGSYS, &mySigAction, NULL);
|
||||
sigaction(SIGPIPE, &mySigAction, NULL);
|
||||
sigaction(SIGALRM, &mySigAction, NULL);
|
||||
sigaction(SIGXCPU, &mySigAction, NULL);
|
||||
sigaction(SIGXFSZ, &mySigAction, NULL);
|
||||
|
||||
std::set_terminate(TerminateHandler);
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user