fix scan coverity issues: uncaught exception
This commit is contained in:
@@ -1092,8 +1092,13 @@ Document::~Document()
|
||||
doc->setInvalid();
|
||||
|
||||
// remove Transient directory
|
||||
Base::FileInfo TransDir(TransientDir.getValue());
|
||||
TransDir.deleteDirectoryRecursive();
|
||||
try {
|
||||
Base::FileInfo TransDir(TransientDir.getValue());
|
||||
TransDir.deleteDirectoryRecursive();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
std::cerr << "Removing transient directory failed: " << e.what() << std::endl;
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <iostream>
|
||||
# include <assert.h>
|
||||
#endif
|
||||
|
||||
@@ -47,7 +48,7 @@ Handled::Handled()
|
||||
Handled::~Handled()
|
||||
{
|
||||
if ((int)(*_lRefCount) != 0)
|
||||
throw Exception("Reference counter of deleted object is not zero!!!!!\n");
|
||||
std::cerr << "Reference counter of deleted object is not zero!!!!!" << std::endl;
|
||||
delete _lRefCount;
|
||||
}
|
||||
|
||||
|
||||
@@ -635,7 +635,7 @@ RecentFilesAction::RecentFilesAction ( Command* pcCmd, QObject * parent )
|
||||
|
||||
RecentFilesAction::~RecentFilesAction()
|
||||
{
|
||||
save();
|
||||
try { save(); } catch (...) {}
|
||||
}
|
||||
|
||||
/** Adds the new item to the recent files. */
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
# include <boost/bind.hpp>
|
||||
# include <sstream>
|
||||
# include <stdexcept>
|
||||
# include <iostream>
|
||||
# include <QCloseEvent>
|
||||
# include <QDir>
|
||||
# include <QFileInfo>
|
||||
@@ -385,7 +386,12 @@ Application::~Application()
|
||||
}
|
||||
|
||||
// save macros
|
||||
MacroCommand::save();
|
||||
try {
|
||||
MacroCommand::save();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
std::cerr << "Saving macros failed: " << e.what() << std::endl;
|
||||
}
|
||||
//App::GetApplication().Detach(this);
|
||||
|
||||
delete d;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <App/Application.h>
|
||||
|
||||
#include "PrefWidgets.h"
|
||||
@@ -557,19 +558,24 @@ void PrefQuantitySpinBox::pushToHistory(const QString &valueq)
|
||||
|
||||
std::string value(val.toUtf8());
|
||||
if (d->handle.isValid()) {
|
||||
// do nothing if the given value is on top of the history
|
||||
std::string tHist = d->handle->GetASCII("Hist0");
|
||||
if (tHist != val.toUtf8().constData()) {
|
||||
for (int i = d->historySize -1 ; i>=0 ;i--) {
|
||||
QByteArray hist1 = "Hist";
|
||||
QByteArray hist0 = "Hist";
|
||||
hist1.append(QByteArray::number(i+1));
|
||||
hist0.append(QByteArray::number(i));
|
||||
std::string tHist = d->handle->GetASCII(hist0);
|
||||
if (!tHist.empty())
|
||||
d->handle->SetASCII(hist1,tHist.c_str());
|
||||
try {
|
||||
// do nothing if the given value is on top of the history
|
||||
std::string tHist = d->handle->GetASCII("Hist0");
|
||||
if (tHist != val.toUtf8().constData()) {
|
||||
for (int i = d->historySize -1 ; i>=0 ;i--) {
|
||||
QByteArray hist1 = "Hist";
|
||||
QByteArray hist0 = "Hist";
|
||||
hist1.append(QByteArray::number(i+1));
|
||||
hist0.append(QByteArray::number(i));
|
||||
std::string tHist = d->handle->GetASCII(hist0);
|
||||
if (!tHist.empty())
|
||||
d->handle->SetASCII(hist1,tHist.c_str());
|
||||
}
|
||||
d->handle->SetASCII("Hist0",value.c_str());
|
||||
}
|
||||
d->handle->SetASCII("Hist0",value.c_str());
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Console().Warning("pushToHistory: %s\n", e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,11 +107,15 @@ FemMesh::~FemMesh()
|
||||
{
|
||||
//Base::Console().Log("FemMesh::~FemMesh():%p\n",this);
|
||||
|
||||
TopoDS_Shape aNull;
|
||||
myMesh->ShapeToMesh(aNull);
|
||||
myMesh->Clear();
|
||||
//myMesh->ClearLog();
|
||||
delete myMesh;
|
||||
try {
|
||||
TopoDS_Shape aNull;
|
||||
myMesh->ShapeToMesh(aNull);
|
||||
myMesh->Clear();
|
||||
//myMesh->ClearLog();
|
||||
delete myMesh;
|
||||
}
|
||||
catch (...) {
|
||||
}
|
||||
}
|
||||
|
||||
FemMesh &FemMesh::operator=(const FemMesh& mesh)
|
||||
|
||||
@@ -112,7 +112,12 @@ MergeExporter::~MergeExporter()
|
||||
}
|
||||
}
|
||||
|
||||
mergingMesh.save(fName.c_str());
|
||||
try {
|
||||
mergingMesh.save(fName.c_str());
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
std::cerr << "Saving mesh failed: " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -168,11 +168,15 @@ DlgEvaluateMeshImp::~DlgEvaluateMeshImp()
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/Mod/Mesh/Evaluation");
|
||||
hGrp->SetBool("CheckNonManifoldPoints", d->checkNonManfoldPoints);
|
||||
hGrp->SetBool("EnableFoldsCheck", d->enableFoldsCheck);
|
||||
hGrp->SetBool("StrictlyDegenerated", d->strictlyDegenerated);
|
||||
try {
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/Mod/Mesh/Evaluation");
|
||||
hGrp->SetBool("CheckNonManifoldPoints", d->checkNonManfoldPoints);
|
||||
hGrp->SetBool("EnableFoldsCheck", d->enableFoldsCheck);
|
||||
hGrp->SetBool("StrictlyDegenerated", d->strictlyDegenerated);
|
||||
}
|
||||
catch (...) {
|
||||
}
|
||||
|
||||
d->vp.clear();
|
||||
delete d;
|
||||
|
||||
@@ -876,7 +876,7 @@ void TaskAttacher::visibilityAutomation(bool opening_not_closing)
|
||||
).toLatin1();
|
||||
Base::Interpreter().runString(code_2.constData());
|
||||
}
|
||||
catch (Base::PyException &e){
|
||||
catch (Base::Exception &e){
|
||||
e.ReportException();
|
||||
}
|
||||
}
|
||||
@@ -884,7 +884,7 @@ void TaskAttacher::visibilityAutomation(bool opening_not_closing)
|
||||
try {
|
||||
Base::Interpreter().runString("del(tv)");
|
||||
}
|
||||
catch (Base::PyException &e) {
|
||||
catch (Base::Exception &e) {
|
||||
e.ReportException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,55 +224,61 @@ std::vector<App::DocumentObject*> TaskFeaturePick::buildFeatures()
|
||||
{
|
||||
int index = 0;
|
||||
std::vector<App::DocumentObject*> result;
|
||||
auto activeBody = PartDesignGui::getBody(false);
|
||||
if (!activeBody)
|
||||
return result;
|
||||
auto activePart = PartDesignGui::getPartFor(activeBody, false);
|
||||
try {
|
||||
auto activeBody = PartDesignGui::getBody(false);
|
||||
if (!activeBody)
|
||||
return result;
|
||||
|
||||
for (std::vector<featureStatus>::const_iterator st = statuses.begin(); st != statuses.end(); st++) {
|
||||
QListWidgetItem* item = ui->listWidget->item(index);
|
||||
auto activePart = PartDesignGui::getPartFor(activeBody, false);
|
||||
|
||||
if (item->isSelected() && !item->isHidden()) {
|
||||
QString t = item->data(Qt::UserRole).toString();
|
||||
auto obj = App::GetApplication().getDocument(documentName.c_str())->getObject(t.toLatin1().data());
|
||||
for (std::vector<featureStatus>::const_iterator st = statuses.begin(); st != statuses.end(); st++) {
|
||||
QListWidgetItem* item = ui->listWidget->item(index);
|
||||
|
||||
//build the dependend copy or reference if wanted by the user
|
||||
if (*st == otherBody || *st == otherPart || *st == notInBody) {
|
||||
if (!ui->radioXRef->isChecked()) {
|
||||
auto copy = makeCopy(obj, "", ui->radioIndependent->isChecked());
|
||||
if (item->isSelected() && !item->isHidden()) {
|
||||
QString t = item->data(Qt::UserRole).toString();
|
||||
auto obj = App::GetApplication().getDocument(documentName.c_str())->getObject(t.toLatin1().data());
|
||||
|
||||
if (*st == otherBody) {
|
||||
activeBody->addObject(copy);
|
||||
}
|
||||
else if (*st == otherPart) {
|
||||
auto oBody = PartDesignGui::getBodyFor(obj, false);
|
||||
if (!oBody)
|
||||
activePart->addObject(copy);
|
||||
else
|
||||
//build the dependend copy or reference if wanted by the user
|
||||
if (*st == otherBody || *st == otherPart || *st == notInBody) {
|
||||
if (!ui->radioXRef->isChecked()) {
|
||||
auto copy = makeCopy(obj, "", ui->radioIndependent->isChecked());
|
||||
|
||||
if (*st == otherBody) {
|
||||
activeBody->addObject(copy);
|
||||
}
|
||||
else if (*st == notInBody) {
|
||||
activeBody->addObject(copy);
|
||||
// doesn't supposed to get here anything but sketch but to be on the safe side better to check
|
||||
if (copy->getTypeId().isDerivedFrom(Sketcher::SketchObject::getClassTypeId())) {
|
||||
Sketcher::SketchObject *sketch = static_cast<Sketcher::SketchObject*>(copy);
|
||||
PartDesignGui::fixSketchSupport(sketch);
|
||||
}
|
||||
else if (*st == otherPart) {
|
||||
auto oBody = PartDesignGui::getBodyFor(obj, false);
|
||||
if (!oBody)
|
||||
activePart->addObject(copy);
|
||||
else
|
||||
activeBody->addObject(copy);
|
||||
}
|
||||
else if (*st == notInBody) {
|
||||
activeBody->addObject(copy);
|
||||
// doesn't supposed to get here anything but sketch but to be on the safe side better to check
|
||||
if (copy->getTypeId().isDerivedFrom(Sketcher::SketchObject::getClassTypeId())) {
|
||||
Sketcher::SketchObject *sketch = static_cast<Sketcher::SketchObject*>(copy);
|
||||
PartDesignGui::fixSketchSupport(sketch);
|
||||
}
|
||||
}
|
||||
result.push_back(copy);
|
||||
}
|
||||
else {
|
||||
result.push_back(obj);
|
||||
}
|
||||
result.push_back(copy);
|
||||
}
|
||||
else {
|
||||
result.push_back(obj);
|
||||
}
|
||||
}
|
||||
else {
|
||||
result.push_back(obj);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
e.ReportException();
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -499,7 +505,7 @@ TaskDlgFeaturePick::~TaskDlgFeaturePick()
|
||||
}
|
||||
Content.clear();
|
||||
|
||||
abortFunction();
|
||||
try { abortFunction(); } catch (...) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -372,20 +372,20 @@ unsigned TaskLinearPatternParameters::getOccurrences(void) const
|
||||
|
||||
TaskLinearPatternParameters::~TaskLinearPatternParameters()
|
||||
{
|
||||
//hide the parts coordinate system axis for selection
|
||||
PartDesign::Body * body = PartDesign::Body::findBodyOf(getObject());
|
||||
if (body) {
|
||||
try {
|
||||
try {
|
||||
//hide the parts coordinate system axis for selection
|
||||
PartDesign::Body * body = PartDesign::Body::findBodyOf(getObject());
|
||||
if (body) {
|
||||
App::Origin *origin = body->getOrigin();
|
||||
ViewProviderOrigin* vpOrigin;
|
||||
vpOrigin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->getViewProvider(origin));
|
||||
vpOrigin->resetTemporaryVisibility();
|
||||
}
|
||||
catch (const Base::Exception &ex) {
|
||||
Base::Console().Error ("%s\n", ex.what () );
|
||||
}
|
||||
}
|
||||
|
||||
catch (const Base::Exception &ex) {
|
||||
Base::Console().Error ("%s\n", ex.what () );
|
||||
}
|
||||
|
||||
delete ui;
|
||||
if (proxy)
|
||||
delete proxy;
|
||||
|
||||
@@ -287,16 +287,16 @@ void TaskMirroredParameters::apply()
|
||||
TaskMirroredParameters::~TaskMirroredParameters()
|
||||
{
|
||||
//hide the parts coordinate system axis for selection
|
||||
PartDesign::Body * body = PartDesign::Body::findBodyOf ( getObject() );
|
||||
if ( body ) {
|
||||
try {
|
||||
try {
|
||||
PartDesign::Body * body = PartDesign::Body::findBodyOf ( getObject() );
|
||||
if ( body ) {
|
||||
App::Origin *origin = body->getOrigin();
|
||||
ViewProviderOrigin* vpOrigin;
|
||||
vpOrigin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->getViewProvider(origin));
|
||||
vpOrigin->resetTemporaryVisibility();
|
||||
} catch (const Base::Exception &ex) {
|
||||
Base::Console().Error ("%s\n", ex.what () );
|
||||
}
|
||||
} catch (const Base::Exception &ex) {
|
||||
Base::Console().Error ("%s\n", ex.what () );
|
||||
}
|
||||
|
||||
delete ui;
|
||||
|
||||
@@ -375,16 +375,16 @@ unsigned TaskPolarPatternParameters::getOccurrences(void) const
|
||||
TaskPolarPatternParameters::~TaskPolarPatternParameters()
|
||||
{
|
||||
//hide the parts coordinate system axis for selection
|
||||
PartDesign::Body * body = PartDesign::Body::findBodyOf ( getObject() );
|
||||
if ( body ) {
|
||||
try {
|
||||
try {
|
||||
PartDesign::Body * body = PartDesign::Body::findBodyOf ( getObject() );
|
||||
if ( body ) {
|
||||
App::Origin *origin = body->getOrigin();
|
||||
ViewProviderOrigin* vpOrigin;
|
||||
vpOrigin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->getViewProvider(origin));
|
||||
vpOrigin->resetTemporaryVisibility ();
|
||||
} catch (const Base::Exception &ex) {
|
||||
Base::Console().Error ("%s\n", ex.what () );
|
||||
}
|
||||
} catch (const Base::Exception &ex) {
|
||||
Base::Console().Error ("%s\n", ex.what () );
|
||||
}
|
||||
|
||||
delete ui;
|
||||
|
||||
@@ -245,16 +245,16 @@ TaskBoxPrimitives::TaskBoxPrimitives(ViewProviderPrimitive* vp, QWidget* parent)
|
||||
TaskBoxPrimitives::~TaskBoxPrimitives()
|
||||
{
|
||||
//hide the parts coordinate system axis for selection
|
||||
PartDesign::Body * body = vp ? PartDesign::Body::findBodyOf(vp->getObject()) : 0;
|
||||
if (body) {
|
||||
try {
|
||||
try {
|
||||
PartDesign::Body * body = vp ? PartDesign::Body::findBodyOf(vp->getObject()) : 0;
|
||||
if (body) {
|
||||
App::Origin *origin = body->getOrigin();
|
||||
Gui::ViewProviderOrigin* vpOrigin;
|
||||
vpOrigin = static_cast<Gui::ViewProviderOrigin*>(Gui::Application::Instance->getViewProvider(origin));
|
||||
vpOrigin->resetTemporaryVisibility();
|
||||
} catch (const Base::Exception &ex) {
|
||||
Base::Console().Error ("%s\n", ex.what () );
|
||||
}
|
||||
} catch (const Base::Exception &ex) {
|
||||
Base::Console().Error ("%s\n", ex.what () );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -360,17 +360,17 @@ bool TaskRevolutionParameters::getReversed(void) const
|
||||
|
||||
TaskRevolutionParameters::~TaskRevolutionParameters()
|
||||
{
|
||||
//hide the parts coordinate system axis for selection
|
||||
PartDesign::Body * body = vp ? PartDesign::Body::findBodyOf(vp->getObject()) : 0;
|
||||
if (body) {
|
||||
try {
|
||||
try {
|
||||
//hide the parts coordinate system axis for selection
|
||||
PartDesign::Body * body = vp ? PartDesign::Body::findBodyOf(vp->getObject()) : 0;
|
||||
if (body) {
|
||||
App::Origin *origin = body->getOrigin();
|
||||
ViewProviderOrigin* vpOrigin;
|
||||
vpOrigin = static_cast<ViewProviderOrigin*>(Gui::Application::Instance->getViewProvider(origin));
|
||||
vpOrigin->resetTemporaryVisibility();
|
||||
} catch (const Base::Exception &ex) {
|
||||
Base::Console().Error ("%s\n", ex.what () );
|
||||
}
|
||||
} catch (const Base::Exception &ex) {
|
||||
Base::Console().Error ("%s\n", ex.what () );
|
||||
}
|
||||
|
||||
delete ui;
|
||||
|
||||
@@ -308,10 +308,14 @@ TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView)
|
||||
|
||||
TaskSketcherElements::~TaskSketcherElements()
|
||||
{
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher/Elements");
|
||||
hGrp->SetBool("Auto-switch to edge", ui->autoSwitchBox->isChecked());
|
||||
hGrp->SetBool("Extended Naming", ui->namingBox->isChecked());
|
||||
|
||||
try {
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher/Elements");
|
||||
hGrp->SetBool("Auto-switch to edge", ui->autoSwitchBox->isChecked());
|
||||
hGrp->SetBool("Extended Naming", ui->namingBox->isChecked());
|
||||
}
|
||||
catch (const Base::Exception&) {
|
||||
}
|
||||
|
||||
connectionElementsChanged.disconnect();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user