mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-22 19:27:13 +01:00
see #2408 catching exceptions in FWBApplication::notify()
This commit is contained in:
parent
8c4fd89855
commit
6dcf4026c6
@ -30,9 +30,14 @@
|
||||
#include "FWBApplication.h"
|
||||
#include "FWWindow.h"
|
||||
|
||||
#include "fwbuilder/FWException.h"
|
||||
|
||||
#include <QtDebug>
|
||||
#include <QTimer>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
using namespace std;
|
||||
|
||||
|
||||
void FWBApplication::quit()
|
||||
{
|
||||
@ -63,3 +68,25 @@ void FWBApplication::delayedQuit()
|
||||
QApplication::quit();
|
||||
}
|
||||
|
||||
bool FWBApplication::notify(QObject *receiver, QEvent *event)
|
||||
{
|
||||
try
|
||||
{
|
||||
return QApplication::notify(receiver, event);
|
||||
} catch (const libfwbuilder::FWException &ex)
|
||||
{
|
||||
cerr << "Caught FWException: " << ex.toString() << std::endl;
|
||||
QCoreApplication::exit(1);
|
||||
} catch (const std::string &s) {
|
||||
cerr << s << std::endl;
|
||||
QCoreApplication::exit(1);
|
||||
} catch (const std::exception &ex) {
|
||||
cerr << ex.what() << std::endl;
|
||||
QCoreApplication::exit(1);
|
||||
}
|
||||
catch (...) {
|
||||
cerr << "Caught unsupported exception" << std::endl;
|
||||
QCoreApplication::exit(1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -29,7 +29,8 @@
|
||||
#include <QApplication>
|
||||
|
||||
|
||||
class FWBApplication : public QApplication {
|
||||
class FWBApplication : public QApplication
|
||||
{
|
||||
|
||||
Q_OBJECT;
|
||||
int timeout;
|
||||
@ -37,6 +38,8 @@ class FWBApplication : public QApplication {
|
||||
public:
|
||||
FWBApplication(int &argc, char **argv) : QApplication(argc, argv) {}
|
||||
|
||||
virtual bool notify(QObject *receiver, QEvent *event);
|
||||
|
||||
public slots:
|
||||
|
||||
void quit();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user