Skip to content

Commit

Permalink
Fix log and thread for exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ousnius committed Jan 8, 2016
1 parent 9e341e1 commit 0764b9d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions BodySlideApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ bool BodySlideApp::OnInit() {

wxInitAllImageHandlers();


preview = nullptr;
sliderView = nullptr;
previewBaseNif = nullptr;
Expand Down Expand Up @@ -154,9 +153,12 @@ bool BodySlideApp::OnExceptionInMainLoop() {
catch (...) {
error = "unknown error";
}

if (sliderView)
sliderView->delayLoad.Stop();

logger.SetFormatter(false);
wxLogFatalError("Unexpected exception has occurred: %s, the program will terminate.", error);
wxLogError("Unexpected exception has occurred: %s, the program will terminate.", error);
wxMessageBox(wxString::Format("Unexpected exception has occurred: %s, the program will terminate.", error), "Unexpected exception", wxICON_ERROR);
return false;
}
Expand All @@ -172,15 +174,21 @@ void BodySlideApp::OnUnhandledException() {
catch (...) {
error = "unknown error";
}

if (sliderView)
sliderView->delayLoad.Stop();

logger.SetFormatter(false);
wxLogFatalError("Unhandled exception has occurred: %s, the program will terminate.", error);
wxLogError("Unhandled exception has occurred: %s, the program will terminate.", error);
wxMessageBox(wxString::Format("Unhandled exception has occurred: %s, the program will terminate.", error), "Unhandled exception", wxICON_ERROR);
}

void BodySlideApp::OnFatalException() {
if (sliderView)
sliderView->delayLoad.Stop();

logger.SetFormatter(false);
wxLogFatalError("Fatal exception has occurred, the program will terminate.");
wxLogError("Fatal exception has occurred, the program will terminate.");
wxMessageBox("Fatal exception has occurred, the program will terminate.", "Fatal exception", wxICON_ERROR);
}

Expand Down

0 comments on commit 0764b9d

Please sign in to comment.