# HG changeset patch # User Santeri Piippo # Date 1399298670 -10800 # Node ID 6d8ca5219a57e6b41e5dd9de8bb258ec0fcddab5 # Parent 335d929c673e97f993eb5f245533592f1ac72a83 - crashcatcher: hide the main window before doing anything and also write the crashlog into a file diff -r 335d929c673e -r 6d8ca5219a57 src/crashCatcher.cc --- a/src/crashCatcher.cc Mon May 05 16:50:36 2014 +0300 +++ b/src/crashCatcher.cc Mon May 05 17:04:30 2014 +0300 @@ -32,6 +32,7 @@ #include "crashCatcher.h" #include "basics.h" #include "dialogs.h" +#include "mainWindow.h" // Is the crash catcher active now? static bool g_crashCatcherActive = false; @@ -59,6 +60,9 @@ exit (149); } + if (g_win != null) + g_win->hide(); + const pid_t pid = getpid(); QProcess proc; QTemporaryFile commandsFile; @@ -89,12 +93,22 @@ proc.waitForFinished (1000); String output = String (proc.readAllStandardOutput()); String err = String (proc.readAllStandardError()); + QFile f ("ldforge-crash.log"); + + if (f.open (QIODevice::WriteOnly)) + { + fprint (f, format ("=== Program crashed with signal %1 ===\n\n%2" + "GDB stdout:\n%3\n" + "GDB stderr:\n%4\n", + sig, (not g_assertionFailure.isEmpty()) ? g_assertionFailure + "\n\n" : "", output, err)); + f.close(); + } bombBox (format ("

Program crashed with signal %1

\n\n" "%2" "

GDB stdout:

%3
\n" "

GDB stderr:

%4
", - sig, (not g_assertionFailure.isEmpty()) ? g_assertionFailure : "", output, err)); + sig, g_assertionFailure, output, err)); } // =============================================================================