Coverity: Uncaught exception

This commit is contained in:
wmayer
2020-07-19 18:22:16 +02:00
parent 2ee8ad1854
commit 43d9e82f97
4 changed files with 42 additions and 7 deletions

View File

@@ -599,7 +599,13 @@ public:
~DocOpenGuard() {
if(flag) {
flag = false;
signal();
try {
signal();
}
catch (const boost::exception&) {
// reported by code analyzers
Base::Console().Warning("~DocOpenGuard: Unexpected boost exception\n");
}
}
}
};
@@ -926,7 +932,13 @@ Application::TransactionSignaller::TransactionSignaller(bool abort, bool signal)
Application::TransactionSignaller::~TransactionSignaller() {
if(--_TransSignalCount == 0 && _TransSignalled) {
_TransSignalled = false;
GetApplication().signalCloseTransaction(abort);
try {
GetApplication().signalCloseTransaction(abort);
}
catch (const boost::exception&) {
// reported by code analyzers
Base::Console().Warning("~TransactionSignaller: Unexpected boost exception\n");
}
}
}

View File

@@ -125,7 +125,7 @@ PyObject * Exception::getPyObject(void)
void Exception::setPyObject( PyObject * pydict)
{
if (pydict!=NULL) {
if (pydict && Py::_Dict_Check(pydict)) {
Py::Dict edict(pydict);
if (edict.hasKey("sfile"))
_file = static_cast<std::string>(Py::String(edict.getItem("sfile")));

View File

@@ -106,7 +106,12 @@ public:
}
~Private() {
vpParent->OnTopWhenSelected.setValue(onTopMode);
try {
vpParent->OnTopWhenSelected.setValue(onTopMode);
}
catch (const Base::Exception& e) {
e.ReportException();
}
}
bool allow(App::Document *doc, App::DocumentObject *obj, const char *subname) {

View File

@@ -1062,7 +1062,8 @@ void View3DInventorViewer::setupEditingRoot(SoNode *node, const Base::Matrix4D *
ViewProviderLink::updateLinks(editViewProvider);
}
void View3DInventorViewer::resetEditingRoot(bool updateLinks) {
void View3DInventorViewer::resetEditingRoot(bool updateLinks)
{
if(!editViewProvider || pcEditingRoot->getNumChildren()<=1)
return;
if(!restoreEditingRoot) {
@@ -1077,8 +1078,25 @@ void View3DInventorViewer::resetEditingRoot(bool updateLinks) {
for(int i=1,count=pcEditingRoot->getNumChildren();i<count;++i)
root->addChild(pcEditingRoot->getChild(i));
pcEditingRoot->getChildren()->truncate(1);
if(updateLinks)
ViewProviderLink::updateLinks(editViewProvider);
// handle exceptions eventually raised by ViewProviderLink
try {
if (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());
}
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();
}
}
SoPickedPoint* View3DInventorViewer::getPointOnRay(const SbVec2s& pos, ViewProvider* vp) const