- wxMessageBox(_T("Program has crashed and will terminate."),
- _T("wxExcept Sample"), wxOK | wxICON_ERROR);
+ wxMessageBox(wxT("Program has crashed and will terminate."),
+ wxT("wxExcept Sample"), wxOK | wxICON_ERROR);
+}
+
+void MyApp::OnAssertFailure(const wxChar *file,
+ int line,
+ const wxChar *func,
+ const wxChar *cond,
+ const wxChar *msg)
+{
+ // take care to not show the message box from a worker thread, this doesn't
+ // work as it doesn't have any event loop
+ if ( !wxIsMainThread() ||
+ wxMessageBox
+ (
+ wxString::Format("An assert failed in %s().", func) +
+ "\n"
+ "Do you want to call the default assert handler?",
+ "wxExcept Sample",
+ wxYES_NO | wxICON_QUESTION
+ ) == wxYES )
+ {
+ wxApp::OnAssertFailure(file, line, func, cond, msg);
+ }