PD: Fix several coverity issues:

* CID 350558: Uninitialized pointer field
* CID 350554: Uninitialized pointer field
* CID 350589: Uninitialized pointer field
* CID 350608: Uninitialized pointer field
* CID 350544: Uncaught exception
* CID 350568: Uncaught exception
* CID 350603: Uncaught exception
* CID 350562: Unchecked dynamic_cast
* CID 350591: Unchecked dynamic_cast
* CID 350583: Unchecked dynamic_cast
* CID 350598: Unchecked dynamic_cast
This commit is contained in:
wmayer
2022-03-13 16:32:19 +01:00
parent edd346cc3d
commit 9ef2470799
4 changed files with 31 additions and 11 deletions

View File

@@ -44,6 +44,7 @@ using namespace Gui;
TaskExtrudeParameters::TaskExtrudeParameters(ViewProviderSketchBased *SketchBasedView, QWidget *parent,
const std::string& pixmapname, const QString& parname)
: TaskSketchBasedParameters(SketchBasedView, parent, pixmapname, parname)
, propReferenceAxis(nullptr)
, ui(new Ui_TaskPadPocketParameters)
{
// we need a separate container widget to add all controls to

View File

@@ -68,6 +68,7 @@ using namespace Gui;
TaskPipeParameters::TaskPipeParameters(ViewProviderPipe *PipeView, bool /*newObj*/, QWidget *parent)
: TaskSketchBasedParameters(PipeView, parent, "PartDesign_AdditivePipe", tr("Pipe parameters"))
, ui(new Ui_TaskPipeParameters)
, stateHandler(nullptr)
{
// we need a separate container widget to add all controls to
proxy = new QWidget(this);
@@ -151,6 +152,8 @@ TaskPipeParameters::~TaskPipeParameters()
static_cast<ViewProviderPipe*>(vp)->highlightReferences(ViewProviderPipe::Profile, false);
}
}
catch (const Standard_OutOfRange&) {
}
catch (const Base::Exception& e) {
// getDocument() may raise an exception
e.ReportException();
@@ -535,8 +538,9 @@ bool TaskPipeParameters::accept()
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
TaskPipeOrientation::TaskPipeOrientation(ViewProviderPipe* PipeView, bool /*newObj*/, QWidget* parent)
: TaskSketchBasedParameters(PipeView, parent, "PartDesign_AdditivePipe", tr("Section orientation")),
ui(new Ui_TaskPipeOrientation)
: TaskSketchBasedParameters(PipeView, parent, "PartDesign_AdditivePipe", tr("Section orientation"))
, ui(new Ui_TaskPipeOrientation)
, stateHandler(nullptr)
{
// we need a separate container widget to add all controls to
proxy = new QWidget(this);
@@ -599,8 +603,12 @@ TaskPipeOrientation::TaskPipeOrientation(ViewProviderPipe* PipeView, bool /*newO
TaskPipeOrientation::~TaskPipeOrientation()
{
if (vp) {
static_cast<ViewProviderPipe*>(vp)->highlightReferences(ViewProviderPipe::AuxiliarySpine, false);
try {
if (vp) {
static_cast<ViewProviderPipe*>(vp)->highlightReferences(ViewProviderPipe::AuxiliarySpine, false);
}
}
catch (const Standard_OutOfRange&) {
}
}
@@ -798,8 +806,9 @@ void TaskPipeOrientation::updateUI(int idx)
// Task Scaling
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
TaskPipeScaling::TaskPipeScaling(ViewProviderPipe* PipeView, bool /*newObj*/, QWidget* parent)
: TaskSketchBasedParameters(PipeView, parent, "PartDesign_AdditivePipe", tr("Section transformation")),
ui(new Ui_TaskPipeScaling)
: TaskSketchBasedParameters(PipeView, parent, "PartDesign_AdditivePipe", tr("Section transformation"))
, ui(new Ui_TaskPipeScaling)
, stateHandler(nullptr)
{
// we need a separate container widget to add all controls to
proxy = new QWidget(this);
@@ -849,8 +858,12 @@ TaskPipeScaling::TaskPipeScaling(ViewProviderPipe* PipeView, bool /*newObj*/, QW
TaskPipeScaling::~TaskPipeScaling()
{
if (vp) {
static_cast<ViewProviderPipe*>(vp)->highlightReferences(ViewProviderPipe::Section, false);
try {
if (vp) {
static_cast<ViewProviderPipe*>(vp)->highlightReferences(ViewProviderPipe::Section, false);
}
}
catch (const Standard_OutOfRange&) {
}
}

View File

@@ -149,9 +149,12 @@ void ViewProviderLoft::highlightReferences(ViewProviderLoft::Reference mode, boo
void ViewProviderLoft::highlightReferences(Part::Feature* base, const std::vector<std::string>& elements, bool on)
{
if (!base)
return;
PartGui::ViewProviderPart* svp = dynamic_cast<PartGui::ViewProviderPart*>(
Gui::Application::Instance->getViewProvider(base));
if (svp == nullptr)
if (!svp)
return;
std::vector<App::Color>& edgeColors = originalLineColors[base->getID()];

View File

@@ -145,11 +145,14 @@ void ViewProviderPipe::highlightReferences(ViewProviderPipe::Reference mode, boo
}
}
void ViewProviderPipe::highlightReferences(Part::Feature* base, const std::vector<std::string>& edges, bool on) {
void ViewProviderPipe::highlightReferences(Part::Feature* base, const std::vector<std::string>& edges, bool on)
{
if (!base)
return;
PartGui::ViewProviderPart* svp = dynamic_cast<PartGui::ViewProviderPart*>(
Gui::Application::Instance->getViewProvider(base));
if (svp == nullptr)
if (!svp)
return;
std::vector<App::Color>& edgeColors = originalLineColors[base->getID()];