summaryrefslogtreecommitdiff
path: root/ExceptionCatchingApplication.hpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2021-09-09 22:49:13 +0200
committerChristoph Berg <myon@debian.org>2021-09-09 22:49:13 +0200
commit7aa182cc9860464e41cc8b1ed7ea2419f70deb91 (patch)
treeae7d07f023c64e3faca0b852d67209a205ab2998 /ExceptionCatchingApplication.hpp
parent23a6b427e4bf791af53d91784c993b67f47e4635 (diff)
parent85895feeaf88bcde26bbfc71e8f6b2047c0f5f41 (diff)
Update upstream source from tag 'upstream/2.5.0_rc6+repack'
Update to upstream version '2.5.0~rc6+repack' with Debian dir b9d3381eb71d484f93fd73a092484a5814baf716
Diffstat (limited to 'ExceptionCatchingApplication.hpp')
-rw-r--r--ExceptionCatchingApplication.hpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/ExceptionCatchingApplication.hpp b/ExceptionCatchingApplication.hpp
index 04c04d62..b9a3f961 100644
--- a/ExceptionCatchingApplication.hpp
+++ b/ExceptionCatchingApplication.hpp
@@ -3,6 +3,7 @@
#include <QApplication>
+#include <boost/log/core.hpp>
#include "Logger.hpp"
class QObject;
@@ -12,8 +13,8 @@ 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 display
-// exceptions in a message box.
+// wrap the base class call with a try block to catch and log any
+// uncaught exceptions.
//
class ExceptionCatchingApplication
: public QApplication
@@ -31,12 +32,16 @@ public:
}
catch (std::exception const& e)
{
- LOG_FATAL (e.what ());
+ LOG_FATAL ("Unexpected exception caught in event loop: " << e.what ());
}
catch (...)
{
- LOG_FATAL ("Unexpected fatal error");
+ 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;
}
};