+ add try/catch block to notify() method

This commit is contained in:
wmayer 2015-01-04 13:26:34 +01:00
parent d3bc389765
commit 0d1fc35b20

View File

@ -1554,24 +1554,29 @@ public:
// Print some more information to the log file (if active) to ease bug fixing // Print some more information to the log file (if active) to ease bug fixing
if (receiver && event) { if (receiver && event) {
std::stringstream dump; try {
dump << "The event type " << (int)event->type() << " was sent to " std::stringstream dump;
<< receiver->metaObject()->className() << "\n"; dump << "The event type " << (int)event->type() << " was sent to "
dump << "Object tree:\n"; << receiver->metaObject()->className() << "\n";
if (receiver->isWidgetType()) { dump << "Object tree:\n";
QWidget* w = qobject_cast<QWidget*>(receiver); if (receiver->isWidgetType()) {
while (w) { QWidget* w = qobject_cast<QWidget*>(receiver);
dump << "\t"; while (w) {
dump << w->metaObject()->className(); dump << "\t";
QString name = w->objectName(); dump << w->metaObject()->className();
if (!name.isEmpty()) QString name = w->objectName();
dump << " (" << (const char*)name.toUtf8() << ")"; if (!name.isEmpty())
w = w->parentWidget(); dump << " (" << (const char*)name.toUtf8() << ")";
if (w) w = w->parentWidget();
dump << " is child of\n"; if (w)
dump << " is child of\n";
}
std::string str = dump.str();
Base::Console().Log("%s",str.c_str());
} }
std::string str = dump.str(); }
Base::Console().Log("%s",str.c_str()); catch (...) {
Base::Console().Log("Invalid recipient and/or event in GUIApplication::notify\n");
} }
} }