- // we don't have anything special to do here
- wxApp::OnAssert(file, line, cond, 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);
+ }