- if ( 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 )
+ // 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 )