summaryrefslogtreecommitdiff
path: root/ExceptionCatchingApplication.hpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2025-09-16 12:37:12 +0200
committerChristoph Berg <myon@debian.org>2025-09-16 12:57:29 +0200
commit5a4967c577ad245a2117b7b2f71c13b1212fe285 (patch)
tree4d09343cfe757239895a0dd9b399242d2a07d7c2 /ExceptionCatchingApplication.hpp
parent23c903a09fb1d73fd20b50323cd80cfb3aba8799 (diff)
Merge 2.7 changes, I had uploaded -1 from the wrong branch.debian/3.0.0_rc1+repack-2
Diffstat (limited to 'ExceptionCatchingApplication.hpp')
-rwxr-xr-xExceptionCatchingApplication.hpp98
1 files changed, 49 insertions, 49 deletions
diff --git a/ExceptionCatchingApplication.hpp b/ExceptionCatchingApplication.hpp
index b9a3f961..175edb8e 100755
--- a/ExceptionCatchingApplication.hpp
+++ b/ExceptionCatchingApplication.hpp
@@ -1,49 +1,49 @@
-#ifndef EXCEPTION_CATCHING_APPLICATION_HPP__
-#define EXCEPTION_CATCHING_APPLICATION_HPP__
-
-#include <QApplication>
-
-#include <boost/log/core.hpp>
-#include "Logger.hpp"
-
-class QObject;
-class QEvent;
-
-//
-// We can't use the GUI after QApplication::exit() is called so
-// uncaught exceptions can get lost on Windows systems where there is
-// no console terminal, so here we override QApplication::notify() and
-// wrap the base class call with a try block to catch and log any
-// uncaught exceptions.
-//
-class ExceptionCatchingApplication
- : public QApplication
-{
-public:
- explicit ExceptionCatchingApplication (int& argc, char * * argv)
- : QApplication {argc, argv}
- {
- }
- bool notify (QObject * receiver, QEvent * e) override
- {
- try
- {
- return QApplication::notify (receiver, e);
- }
- catch (std::exception const& e)
- {
- LOG_FATAL ("Unexpected exception caught in event loop: " << e.what ());
- }
- catch (...)
- {
- LOG_FATAL ("Unexpected unknown exception caught in event loop");
- }
- // There's nowhere to go from here as Qt will not pass exceptions
- // through the event loop, so we must abort.
- boost::log::core::get ()->flush ();
- qFatal ("Aborting");
- return false;
- }
-};
-
-#endif
+#ifndef EXCEPTION_CATCHING_APPLICATION_HPP__
+#define EXCEPTION_CATCHING_APPLICATION_HPP__
+
+#include <QApplication>
+
+#include <boost/log/core.hpp>
+#include "Logger.hpp"
+
+class QObject;
+class QEvent;
+
+//
+// We can't use the GUI after QApplication::exit() is called so
+// uncaught exceptions can get lost on Windows systems where there is
+// no console terminal, so here we override QApplication::notify() and
+// wrap the base class call with a try block to catch and log any
+// uncaught exceptions.
+//
+class ExceptionCatchingApplication
+ : public QApplication
+{
+public:
+ explicit ExceptionCatchingApplication (int& argc, char * * argv)
+ : QApplication {argc, argv}
+ {
+ }
+ bool notify (QObject * receiver, QEvent * e) override
+ {
+ try
+ {
+ return QApplication::notify (receiver, e);
+ }
+ catch (std::exception const& e)
+ {
+ LOG_FATAL ("Unexpected exception caught in event loop: " << e.what ());
+ }
+ catch (...)
+ {
+ LOG_FATAL ("Unexpected unknown exception caught in event loop");
+ }
+ // There's nowhere to go from here as Qt will not pass exceptions
+ // through the event loop, so we must abort.
+ boost::log::core::get ()->flush ();
+ qFatal ("Aborting");
+ return false;
+ }
+};
+
+#endif