mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Catch all exceptions in onPaint functions, because otherwise we show a message box. Message boxes while in a paint handler lead to a crash on win32.
Made a CATCH_ALL_ERRORS macro containing the common catch statements. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1034 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+3
-17
@@ -40,7 +40,7 @@ class MSE : public wxApp {
|
||||
*/
|
||||
int OnRun();
|
||||
/// On exit: write the settings to the config file
|
||||
int OnExit();
|
||||
int OnExit();
|
||||
/// On exception: display error message
|
||||
bool OnExceptionInMainLoop();
|
||||
};
|
||||
@@ -209,14 +209,7 @@ int MSE::OnRun() {
|
||||
(new WelcomeWindow())->Show();
|
||||
return wxApp::OnRun();
|
||||
|
||||
} catch (const Error& e) {
|
||||
handle_error(e, false);
|
||||
} catch (const std::exception& e) {
|
||||
// we don't throw std::exception ourselfs, so this is probably something serious
|
||||
handle_error(InternalError(String(e.what(), IF_UNICODE(wxConvLocal, wxSTRING_MAXLEN) )), false);
|
||||
} catch (...) {
|
||||
handle_error(InternalError(_("An unexpected exception occurred!")), false);
|
||||
}
|
||||
} CATCH_ALL_ERRORS(true);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -234,13 +227,6 @@ int MSE::OnExit() {
|
||||
bool MSE::OnExceptionInMainLoop() {
|
||||
try {
|
||||
throw; // rethrow the exception, so we can examine it
|
||||
} catch (const Error& e) {
|
||||
handle_error(e, false);
|
||||
} catch (const std::exception& e) {
|
||||
// we don't throw std::exception ourselfs, so this is probably something serious
|
||||
handle_error(InternalError(String(e.what(), IF_UNICODE(wxConvLocal, wxSTRING_MAXLEN) )), false);
|
||||
} catch (...) {
|
||||
handle_error(InternalError(_("An unexpected exception occurred!")), false);
|
||||
}
|
||||
} CATCH_ALL_ERRORS(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user