Launch the error report application instead of sending an email.
This commit is contained in:
parent
987f140998
commit
059287db6a
2 changed files with 36 additions and 5 deletions
|
@ -83,7 +83,8 @@ using namespace std;
|
||||||
#define LOG_IN_FILE NEL_LOG_IN_FILE
|
#define LOG_IN_FILE NEL_LOG_IN_FILE
|
||||||
|
|
||||||
// If true, debug system will trap crash even if the application is in debugger
|
// If true, debug system will trap crash even if the application is in debugger
|
||||||
static const bool TrapCrashInDebugger = false;
|
//static const bool TrapCrashInDebugger = false;
|
||||||
|
static const bool TrapCrashInDebugger = true;
|
||||||
|
|
||||||
#ifdef DEBUG_NEW
|
#ifdef DEBUG_NEW
|
||||||
#define new DEBUG_NEW
|
#define new DEBUG_NEW
|
||||||
|
|
|
@ -92,6 +92,36 @@ static bool CanSendMailReport= false;
|
||||||
|
|
||||||
static bool DebugDefaultBehavior, QuitDefaultBehavior;
|
static bool DebugDefaultBehavior, QuitDefaultBehavior;
|
||||||
|
|
||||||
|
static void doSendReport()
|
||||||
|
{
|
||||||
|
std::string filename;
|
||||||
|
|
||||||
|
// Unfortunately Qt 4.8.5 on Windows messes up arguments.
|
||||||
|
// As a workaround the report filename is hardcoded for now.
|
||||||
|
//
|
||||||
|
//filename = "report_";
|
||||||
|
//filename += NLMISC::toString( time( NULL ) );
|
||||||
|
//filename += ".txt";
|
||||||
|
|
||||||
|
filename = "rcerrorlog.txt";
|
||||||
|
|
||||||
|
std::ofstream f;
|
||||||
|
f.open( filename.c_str() );
|
||||||
|
if( !f.good() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
f << Body;
|
||||||
|
|
||||||
|
f.close();
|
||||||
|
|
||||||
|
#ifdef NL_OS_WINDOWS
|
||||||
|
NLMISC::launchProgram( "rcerror.exe", filename );
|
||||||
|
#else
|
||||||
|
NLMISC::launchProgram( "rcerror", filename );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static void sendEmail()
|
static void sendEmail()
|
||||||
{
|
{
|
||||||
if (CanSendMailReport && SendMessage(sendReport, BM_GETCHECK, 0, 0) != BST_CHECKED)
|
if (CanSendMailReport && SendMessage(sendReport, BM_GETCHECK, 0, 0) != BST_CHECKED)
|
||||||
|
@ -133,7 +163,7 @@ static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
else if ((HWND) lParam == debug)
|
else if ((HWND) lParam == debug)
|
||||||
{
|
{
|
||||||
sendEmail();
|
doSendReport();
|
||||||
NeedExit = true;
|
NeedExit = true;
|
||||||
Result = ReportDebug;
|
Result = ReportDebug;
|
||||||
if (DebugDefaultBehavior)
|
if (DebugDefaultBehavior)
|
||||||
|
@ -143,13 +173,13 @@ static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
else if ((HWND) lParam == ignore)
|
else if ((HWND) lParam == ignore)
|
||||||
{
|
{
|
||||||
sendEmail();
|
doSendReport();
|
||||||
NeedExit = true;
|
NeedExit = true;
|
||||||
Result = ReportIgnore;
|
Result = ReportIgnore;
|
||||||
}
|
}
|
||||||
else if ((HWND) lParam == quit)
|
else if ((HWND) lParam == quit)
|
||||||
{
|
{
|
||||||
sendEmail();
|
doSendReport();
|
||||||
NeedExit = true;
|
NeedExit = true;
|
||||||
Result = ReportQuit;
|
Result = ReportQuit;
|
||||||
|
|
||||||
|
@ -191,7 +221,7 @@ static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM
|
||||||
if (wParam == 27)
|
if (wParam == 27)
|
||||||
{
|
{
|
||||||
// ESC -> ignore
|
// ESC -> ignore
|
||||||
sendEmail();
|
doSendReport();
|
||||||
NeedExit = true;
|
NeedExit = true;
|
||||||
Result = ReportIgnore;
|
Result = ReportIgnore;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue