Gui: [skip ci] Coverity: Uncaught exception
This commit is contained in:
@@ -1085,17 +1085,30 @@ void View3DInventorViewer::resetEditingRoot(bool updateLinks)
|
||||
ViewProviderLink::updateLinks(editViewProvider);
|
||||
}
|
||||
catch (const Py::Exception& e) {
|
||||
Py::Object o = Py::type(e);
|
||||
if (o.isString()) {
|
||||
Py::String s(o);
|
||||
Base::Console().Warning("%s\n", s.as_std_string("utf-8").c_str());
|
||||
/* coverity[UNCAUGHT_EXCEPT] Uncaught exception */
|
||||
// Coverity created several reports when removeViewProvider()
|
||||
// is used somewhere in a destructor which indirectly invokes
|
||||
// resetEditingRoot().
|
||||
// Now theoretically Py::type can throw an exception which nowhere
|
||||
// will be handled and thus terminates the application. So, add an
|
||||
// extra try/catch block here.
|
||||
try {
|
||||
Py::Object o = Py::type(e);
|
||||
if (o.isString()) {
|
||||
Py::String s(o);
|
||||
Base::Console().Warning("%s\n", s.as_std_string("utf-8").c_str());
|
||||
}
|
||||
else {
|
||||
Py::String s(o.repr());
|
||||
Base::Console().Warning("%s\n", s.as_std_string("utf-8").c_str());
|
||||
}
|
||||
// Prints message to console window if we are in interactive mode
|
||||
PyErr_Print();
|
||||
}
|
||||
else {
|
||||
Py::String s(o.repr());
|
||||
Base::Console().Warning("%s\n", s.as_std_string("utf-8").c_str());
|
||||
catch (Py::Exception& e) {
|
||||
e.clear();
|
||||
Base::Console().Error("Unexpected exception raised in View3DInventorViewer::resetEditingRoot\n");
|
||||
}
|
||||
// Prints message to console window if we are in interactive mode
|
||||
PyErr_Print();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user