From e93c1ccb73f787c6e7e13f39ef965f2b5bc3ba22 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Thu, 12 Mar 2015 16:49:47 +0100 Subject: [PATCH] Install the crash handler earlier during startup This moves the crash handler installation during the OCC::Application contruction. This still leaves a window where crashes wouldn't be caught, leaving the QtSingleApplication and theme initialization code unreported, but isn't requiring any refactoring for now. Issue #2952 --- src/gui/application.cpp | 9 +++++++++ src/gui/application.h | 7 +++++++ src/gui/main.cpp | 13 ------------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/gui/application.cpp b/src/gui/application.cpp index 734f7f18b..eb2fac6ee 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -42,6 +42,10 @@ #include #endif +#if defined(WITH_CRASHREPORTER) +#include +#endif + #include #include #include @@ -106,6 +110,11 @@ Application::Application(int &argc, char **argv) : if (isRunning()) return; +#if defined(WITH_CRASHREPORTER) + if (ConfigFile().crashReporter()) + _crashHandler.reset(new CrashReporter::Handler( QDir::tempPath(), true, CRASHREPORTER_EXECUTABLE )); +#endif + setupLogging(); setupTranslations(); diff --git a/src/gui/application.h b/src/gui/application.h index 411eb9aea..90fee1009 100644 --- a/src/gui/application.h +++ b/src/gui/application.h @@ -34,6 +34,10 @@ class QMessageBox; class QSystemTrayIcon; class QSocket; +namespace CrashReporter { +class Handler; +} + namespace OCC { class Theme; class Folder; @@ -109,6 +113,9 @@ private: QTimer _checkConnectionTimer; +#if defined(WITH_CRASHREPORTER) + QScopedPointer _crashHandler; +#endif QScopedPointer _folderManager; friend class ownCloudGui; // for _startupNetworkError diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 812b659aa..b505fb0e5 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -28,13 +28,6 @@ #include "updater/updater.h" - -#include "config.h" -#ifdef WITH_CRASHREPORTER - #include "configfile.h" - #include -#endif - #include #include @@ -59,12 +52,6 @@ int main(int argc, char **argv) #endif OCC::Application app(argc, argv); - -#ifdef WITH_CRASHREPORTER - if (ConfigFile().crashReporter()) - new CrashReporter::Handler( QDir::tempPath(), true, CRASHREPORTER_EXECUTABLE ); -#endif - #ifndef Q_OS_WIN signal(SIGPIPE, SIG_IGN); #endif -- 2.30.2