summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/app/main.cpp6
-rw-r--r--src/tools/qtcreatorcrashhandler/crashhandlersetup.cpp4
-rw-r--r--src/tools/qtcreatorcrashhandler/crashhandlersetup.h8
3 files changed, 10 insertions, 8 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp
index ce7ed2dcb9..d2fa179bdd 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -317,7 +317,7 @@ int main(int argc, char **argv)
const int threadCount = QThreadPool::globalInstance()->maxThreadCount();
QThreadPool::globalInstance()->setMaxThreadCount(qMax(4, 2 * threadCount));
- setupCrashHandler(); // Display a backtrace once a serious signal is delivered.
+ CrashHandlerSetup setupCrashHandler; // Display a backtrace once a serious signal is delivered.
#ifdef ENABLE_QT_BREAKPAD
QtSystemExceptionHandler systemExceptionHandler;
@@ -518,7 +518,5 @@ int main(int argc, char **argv)
// shutdown plugin manager on the exit
QObject::connect(&app, SIGNAL(aboutToQuit()), &pluginManager, SLOT(shutdown()));
- const int r = app.exec();
- cleanupCrashHandler();
- return r;
+ return app.exec();
}
diff --git a/src/tools/qtcreatorcrashhandler/crashhandlersetup.cpp b/src/tools/qtcreatorcrashhandler/crashhandlersetup.cpp
index 73d33c2d4d..6cf487e80a 100644
--- a/src/tools/qtcreatorcrashhandler/crashhandlersetup.cpp
+++ b/src/tools/qtcreatorcrashhandler/crashhandlersetup.cpp
@@ -88,7 +88,7 @@ extern "C" void signalHandler(int signal)
}
#endif // BUILD_CRASH_HANDLER
-void setupCrashHandler()
+CrashHandlerSetup::CrashHandlerSetup()
{
#ifdef BUILD_CRASH_HANDLER
if (qgetenv("QTC_USE_CRASH_HANDLER").isEmpty())
@@ -138,7 +138,7 @@ void setupCrashHandler()
#endif // BUILD_CRASH_HANDLER
}
-void cleanupCrashHandler()
+CrashHandlerSetup::~CrashHandlerSetup()
{
#ifdef BUILD_CRASH_HANDLER
delete[] crashHandlerPathC;
diff --git a/src/tools/qtcreatorcrashhandler/crashhandlersetup.h b/src/tools/qtcreatorcrashhandler/crashhandlersetup.h
index f13cdb6f6b..314d6ab5e4 100644
--- a/src/tools/qtcreatorcrashhandler/crashhandlersetup.h
+++ b/src/tools/qtcreatorcrashhandler/crashhandlersetup.h
@@ -31,7 +31,11 @@
#ifndef CRASHHANDLERSETUP_H
#define CRASHHANDLERSETUP_H
-void setupCrashHandler();
-void cleanupCrashHandler();
+class CrashHandlerSetup
+{
+public:
+ CrashHandlerSetup();
+ ~CrashHandlerSetup();
+};
#endif // CRASHHANDLERSETUP_H