Coverity fixes
CID 174671 CID 174670 CID 174669 CID 174668 CID 174667 CID 174664
This commit is contained in:
@@ -433,6 +433,7 @@ double DrawUtil::getDefaultLineWeight(std::string lineType)
|
||||
auto lg = LineGroup::lineGroupFactory(lgName);
|
||||
|
||||
double weight = lg->getWeight(lineType);
|
||||
delete lg; //Coverity CID 174671
|
||||
return weight;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,19 +75,9 @@ using namespace TechDrawGui;
|
||||
//find a page in Selection, Document or CurrentWindow.
|
||||
TechDraw::DrawPage* DrawGuiUtil::findPage(Gui::Command* cmd)
|
||||
{
|
||||
TechDraw::DrawPage* page = nullptr;
|
||||
TechDraw::DrawPage* page;
|
||||
bool warn = true;
|
||||
|
||||
//default to currently displayed DrawPage is there is one
|
||||
Gui::MainWindow* w = Gui::getMainWindow();
|
||||
Gui::MDIView* mv = w->activeWindow();
|
||||
MDIViewPage* mvp = dynamic_cast<MDIViewPage*>(mv);
|
||||
if (mvp) {
|
||||
QString windowTitle = mvp->windowTitle();
|
||||
QGVPage* qp = mvp->getQGVPage();
|
||||
page = qp->getDrawPage();
|
||||
}
|
||||
|
||||
//check Selection and/or Document for a DrawPage
|
||||
std::vector<App::DocumentObject*> selPages = cmd->getSelection().getObjectsOfType(TechDraw::DrawPage::getClassTypeId());
|
||||
if (selPages.empty()) { //no page in selection
|
||||
@@ -114,6 +104,18 @@ TechDraw::DrawPage* DrawGuiUtil::findPage(Gui::Command* cmd)
|
||||
page = static_cast<TechDraw::DrawPage*>(selPages.front());
|
||||
}
|
||||
|
||||
//default to currently displayed DrawPage is there is one //code moved Coverity CID 174668
|
||||
if (page == nullptr) {
|
||||
Gui::MainWindow* w = Gui::getMainWindow();
|
||||
Gui::MDIView* mv = w->activeWindow();
|
||||
MDIViewPage* mvp = dynamic_cast<MDIViewPage*>(mv);
|
||||
if (mvp) {
|
||||
QString windowTitle = mvp->windowTitle();
|
||||
QGVPage* qp = mvp->getQGVPage();
|
||||
page = qp->getDrawPage();
|
||||
}
|
||||
}
|
||||
|
||||
if ((page == nullptr) &&
|
||||
(warn) ) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No page found"),
|
||||
|
||||
@@ -44,6 +44,7 @@ QGICenterLine::QGICenterLine()
|
||||
setWidth(0.0);
|
||||
setStyle(getCenterStyle());
|
||||
setColor(getCenterColor());
|
||||
m_isintersection = false; //Coverity CID 174669
|
||||
}
|
||||
|
||||
void QGICenterLine::draw()
|
||||
|
||||
@@ -68,6 +68,7 @@ ViewProviderDimension::ViewProviderDimension()
|
||||
std::string lgName = hGrp->GetASCII("LineGroup","FC 0.70mm");
|
||||
auto lg = TechDraw::LineGroup::lineGroupFactory(lgName);
|
||||
double weight = lg->getWeight("Thin");
|
||||
delete lg; //Coverity CID 174670
|
||||
ADD_PROPERTY_TYPE(LineWidth,(weight) ,group,(App::PropertyType)(App::Prop_None),"Dimension line weight");
|
||||
|
||||
hGrp = App::GetApplication().GetUserParameter()
|
||||
|
||||
@@ -194,6 +194,7 @@ void ViewProviderGeomHatch::getParameters(void)
|
||||
std::string lgName = hGrp->GetASCII("LineGroup","FC 0.70mm");
|
||||
auto lg = TechDraw::LineGroup::lineGroupFactory(lgName);
|
||||
double weight = lg->getWeight("Graphic");
|
||||
delete lg; //Coverity CID 174667
|
||||
WeightPattern.setValue(weight);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ ViewProviderViewPart::ViewProviderViewPart()
|
||||
|
||||
weight = lg->getWeight("Extra");
|
||||
ADD_PROPERTY_TYPE(ExtraWidth,(weight),group,App::Prop_None,"The thickness of LineGroup Extra lines, if enabled");
|
||||
delete lg; //Coverity CID 174664
|
||||
|
||||
//decorations
|
||||
ADD_PROPERTY_TYPE(HorizCenterLine ,(false),dgroup,App::Prop_None,"Show a horizontal centerline through view");
|
||||
|
||||
Reference in New Issue
Block a user