CrashRpt tweaks, checking.
- show a message box if setup fails - log setup status
This commit is contained in:
parent
80cc2ff8c3
commit
45d67406a4
3 changed files with 25 additions and 4 deletions
|
@ -37,6 +37,10 @@ namespace {
|
||||||
|
|
||||||
bool isCanvasImplementationRegistered()
|
bool isCanvasImplementationRegistered()
|
||||||
{
|
{
|
||||||
|
if (!globals) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
SGCommandMgr* cmd = globals->get_commands();
|
SGCommandMgr* cmd = globals->get_commands();
|
||||||
return (cmd->getCommand("canvas-message-box") != NULL);
|
return (cmd->getCommand("canvas-message-box") != NULL);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +50,7 @@ bool isCanvasImplementationRegistered()
|
||||||
HWND getMainViewerHWND()
|
HWND getMainViewerHWND()
|
||||||
{
|
{
|
||||||
osgViewer::Viewer::Windows windows;
|
osgViewer::Viewer::Windows windows;
|
||||||
if (!globals->get_renderer() || !globals->get_renderer()->getViewer()) {
|
if (!globals || !globals->get_renderer() || !globals->get_renderer()->getViewer()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,9 @@ using std::endl;
|
||||||
|
|
||||||
#if defined(HAVE_CRASHRPT)
|
#if defined(HAVE_CRASHRPT)
|
||||||
#include <CrashRpt.h>
|
#include <CrashRpt.h>
|
||||||
|
|
||||||
|
bool global_crashRptEnabled = false;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string homedir;
|
std::string homedir;
|
||||||
|
@ -210,8 +213,14 @@ int main ( int argc, char **argv )
|
||||||
// Install crash reporting
|
// Install crash reporting
|
||||||
int nResult = crInstall(&info);
|
int nResult = crInstall(&info);
|
||||||
if(nResult!=0) {
|
if(nResult!=0) {
|
||||||
std::cerr << "failed to install crash reporting engine" << std::endl;
|
char buf[1024];
|
||||||
|
crGetLastErrorMsg(buf, 1024);
|
||||||
|
flightgear::modalMessageBox("CrashRpt setup failed",
|
||||||
|
"Failed to setup crash-reporting engine, check the installation is not damaged.",
|
||||||
|
buf);
|
||||||
} else {
|
} else {
|
||||||
|
global_crashRptEnabled = true;
|
||||||
|
|
||||||
crAddProperty("hudson-build-id", HUDSON_BUILD_ID);
|
crAddProperty("hudson-build-id", HUDSON_BUILD_ID);
|
||||||
char buf[16];
|
char buf[16];
|
||||||
::snprintf(buf, 16, "%d", HUDSON_BUILD_NUMBER);
|
::snprintf(buf, 16, "%d", HUDSON_BUILD_NUMBER);
|
||||||
|
|
|
@ -35,6 +35,10 @@
|
||||||
|
|
||||||
#if defined(HAVE_CRASHRPT)
|
#if defined(HAVE_CRASHRPT)
|
||||||
#include <CrashRpt.h>
|
#include <CrashRpt.h>
|
||||||
|
|
||||||
|
// defined in bootstrap.cxx
|
||||||
|
extern bool global_crashRptEnabled;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Class references
|
// Class references
|
||||||
|
@ -346,8 +350,12 @@ static void logToFile()
|
||||||
sglog().logToFile(logPath, SG_ALL, SG_INFO);
|
sglog().logToFile(logPath, SG_ALL, SG_INFO);
|
||||||
|
|
||||||
#if defined(HAVE_CRASHRPT)
|
#if defined(HAVE_CRASHRPT)
|
||||||
crAddFile2(logPath.c_str(), NULL, "FlightGear Log File", CR_AF_MAKE_FILE_COPY);
|
if (global_crashRptEnabled) {
|
||||||
SG_LOG( SG_GENERAL, SG_INFO, "CrashRpt enabled");
|
crAddFile2(logPath.c_str(), NULL, "FlightGear Log File", CR_AF_MAKE_FILE_COPY);
|
||||||
|
SG_LOG( SG_GENERAL, SG_INFO, "CrashRpt enabled");
|
||||||
|
} else {
|
||||||
|
SG_LOG(SG_GENERAL, SG_WARN, "CrashRpt enabled at compile time but failed to install");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue