bool isCanvasImplementationRegistered()
{
+ if (!globals) {
+ return false;
+ }
+
SGCommandMgr* cmd = globals->get_commands();
return (cmd->getCommand("canvas-message-box") != NULL);
}
HWND getMainViewerHWND()
{
osgViewer::Viewer::Windows windows;
- if (!globals->get_renderer() || !globals->get_renderer()->getViewer()) {
+ if (!globals || !globals->get_renderer() || !globals->get_renderer()->getViewer()) {
return 0;
}
#if defined(HAVE_CRASHRPT)
#include <CrashRpt.h>
+
+bool global_crashRptEnabled = false;
+
#endif
std::string homedir;
// Install crash reporting
int nResult = crInstall(&info);
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 {
+ global_crashRptEnabled = true;
+
crAddProperty("hudson-build-id", HUDSON_BUILD_ID);
char buf[16];
::snprintf(buf, 16, "%d", HUDSON_BUILD_NUMBER);
#if defined(HAVE_CRASHRPT)
#include <CrashRpt.h>
+
+// defined in bootstrap.cxx
+extern bool global_crashRptEnabled;
+
#endif
// Class references
sglog().logToFile(logPath, SG_ALL, SG_INFO);
#if defined(HAVE_CRASHRPT)
- crAddFile2(logPath.c_str(), NULL, "FlightGear Log File", CR_AF_MAKE_FILE_COPY);
- SG_LOG( SG_GENERAL, SG_INFO, "CrashRpt enabled");
+ if (global_crashRptEnabled) {
+ 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
}