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:
twanvl
2008-08-02 17:04:30 +00:00
parent fb411139d1
commit 76c71e5800
7 changed files with 41 additions and 29 deletions
+12
View File
@@ -123,5 +123,17 @@ void handle_warning(const String& w, bool now = true);
/** Should be called repeatedly (e.g. in an onIdle event handler) */
void handle_pending_errors();
/// Catch all types of errors, and pass then to handle_error
#define CATCH_ALL_ERRORS(handle_now) \
catch (const Error& e) { \
handle_error(e, false, handle_now); \
} catch (const std::exception& e) { \
/* we don't throw std::exception ourselfs, so this is probably something serious */ \
String message(e.what(), IF_UNICODE(wxConvLocal, wxSTRING_MAXLEN) ); \
handle_error(InternalError(message), false, handle_now); \
} catch (...) { \
handle_error(InternalError(_("An unexpected exception occurred!")), false, handle_now); \
}
// ----------------------------------------------------------------------------- : EOF
#endif