MCPcopy Create free account
hub / github.com/TypesettingTools/Aegisub / UnhandledException

Method UnhandledException

src/main.cpp:368–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366}
367
368void AegisubApp::UnhandledException(bool stackWalk) {
369#if (!defined(_DEBUG) || defined(WITH_EXCEPTIONS)) && (wxUSE_ON_FATAL_EXCEPTION+0)
370 bool any = false;
371 agi::fs::path path;
372 for (auto& frame : frames) {
373 auto c = frame->context.get();
374 if (!c || !c->ass || !c->subsController) continue;
375
376 path = config::path->Decode("?user/recovered");
377 agi::fs::CreateDirectory(path);
378
379 auto filename = c->subsController->Filename().stem();
380 filename.replace_extension(agi::format("%s.ass", agi::util::strftime("%Y-%m-%d-%H-%M-%S")));
381 path /= filename;
382 c->subsController->Save(path);
383
384 any = true;
385 }
386
387 if (stackWalk)
388 crash_writer::Write();
389
390 if (any) {
391 // Inform user of crash.
392 wxMessageBox(agi::wxformat(exception_message, path), _("Program error"), wxOK | wxICON_ERROR | wxCENTER, nullptr);
393 }
394 else if (LastStartupState) {
395 wxMessageBox(fmt_wx("Aegisub has crashed while starting up!\n\nThe last startup step attempted was: %s.", LastStartupState), _("Program error"), wxOK | wxICON_ERROR | wxCENTER);
396 }
397#endif
398}
399
400void AegisubApp::OnUnhandledException() {
401 UnhandledException(false);

Callers

nothing calls this directly

Calls 8

strftimeFunction · 0.85
wxformatFunction · 0.85
DecodeMethod · 0.80
FilenameMethod · 0.80
formatFunction · 0.70
WriteFunction · 0.70
getMethod · 0.45
SaveMethod · 0.45

Tested by

no test coverage detected