In our crash handler, we use wxDebugReport::Process() which according to documentation (http://docs.wxwidgets.org/stable/classwx_debug_report.html#a3ec35bb65b88aac386a399b27ef940a5), does basically nothing. Is that intended here?
void CodeBlocksApp::OnFatalException()
{
#if wxUSE_DEBUGREPORT && wxUSE_XML && wxUSE_ON_FATAL_EXCEPTION
wxDebugReport report;
wxDebugReportPreviewStd preview;
report.AddAll();
if ( preview.Show(report) )
report.Process();
#else
cbMessageBox(wxString::Format(_("Something has gone wrong inside %s and it will terminate immediately.\n"
"We are sorry for the inconvenience..."), appglobals::AppName.wx_str()));
#endif
}
Is there any reason the crash handler should not attempt to save files?
Index: src/src/app.cpp
===================================================================
--- src/src/app.cpp (revision 9491)
+++ src/src/app.cpp (working copy)
@@ -848,6 +848,29 @@
cbMessageBox(wxString::Format(_("Something has gone wrong inside %s and it will terminate immediately.\n"
"We are sorry for the inconvenience..."), appglobals::AppName.wx_str()));
#endif
+ // try to save files
+ EditorManager* edMan = Manager::Get()->GetEditorManager();
+ wxString fileList;
+ for (int i = 0; i < edMan->GetEditorsCount(); ++i)
+ {
+ cbEditor* ed = edMan->GetBuiltinEditor(i);
+ if (ed && ed->GetModified())
+ {
+ wxString crashFn;
+ for (int j = 0; j < 99; ++j)
+ {
+ crashFn = ed->GetFilename() + wxString::Format(wxT(".cb_crash_%02d"), j);
+ if (!wxFileExists(crashFn))
+ break;
+ }
+ if (cbSaveToFile(crashFn, ed->GetControl()->GetText(), ed->GetEncoding(), ed->GetUseBom()))
+ fileList += _("\n(success) ") + crashFn;
+ else
+ fileList += _("\n(failure) ") + crashFn;
+ }
+ }
+ if (!fileList.IsEmpty())
+ cbMessageBox(_("Attempted recovery of:") + fileList, _("Code::Blocks crash handler"));
}
int CodeBlocksApp::BatchJob()