mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Don't show message boxes for assertion failures, since this can lead to crashes when in OnPaint
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1197 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -46,6 +46,10 @@ class MSE : public wxApp {
|
||||
int OnExit();
|
||||
/// On exception: display error message
|
||||
bool OnExceptionInMainLoop();
|
||||
/// Fancier assert
|
||||
#if defined(_MSC_VER) && defined(_DEBUG)
|
||||
void OnAssert(const wxChar *file, int line, const wxChar *cond, const wxChar *msg);
|
||||
#endif
|
||||
};
|
||||
|
||||
IMPLEMENT_APP(MSE)
|
||||
@@ -265,3 +269,18 @@ bool MSE::OnExceptionInMainLoop() {
|
||||
} CATCH_ALL_ERRORS(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && defined(_DEBUG)
|
||||
// Print assert failures to debug output
|
||||
void msvc_assert(const char*, const char*, const char*, unsigned);
|
||||
void MSE::OnAssert(const wxChar *file, int line, const wxChar *cond, const wxChar *msg) {
|
||||
#ifdef UNICODE
|
||||
char file_[1024]; wcstombs(file_,file,1023);
|
||||
char cond_[1024]; wcstombs(cond_,cond,1023);
|
||||
char msg_ [1024]; wcstombs(msg_, msg, 1023);
|
||||
msvc_assert(msg_, cond_, file_, line);
|
||||
#else
|
||||
msvc_assert(msg, cond, file, line);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user