PVS: V773 A memory leak is possible
This commit is contained in:
@@ -52,7 +52,7 @@ ImageOrientationDialog::ImageOrientationDialog()
|
||||
|
||||
ImageOrientationDialog::~ImageOrientationDialog()
|
||||
{
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ImageOrientationDialog::accept()
|
||||
|
||||
@@ -57,6 +57,10 @@ m_layerName("none")
|
||||
CDxfWrite::~CDxfWrite()
|
||||
{
|
||||
delete m_ofs;
|
||||
delete m_ssBlock;
|
||||
delete m_ssBlkRecord;
|
||||
delete m_ssEntity;
|
||||
delete m_ssLayer;
|
||||
}
|
||||
|
||||
void CDxfWrite::init(void)
|
||||
|
||||
@@ -40,6 +40,7 @@ DlgSettingsImportExport::DlgSettingsImportExport(QWidget* parent)
|
||||
DlgSettingsImportExport::~DlgSettingsImportExport()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DlgSettingsImportExport::saveSettings()
|
||||
|
||||
@@ -994,6 +994,7 @@ void PartGui::goDimensionAngularNoTask(const VectorAdapter &vector1Adapter, cons
|
||||
}
|
||||
|
||||
DimensionAngular *dimension = new DimensionAngular();
|
||||
dimension->ref();
|
||||
dimension->matrix.setValue(dimSys);
|
||||
dimension->radius.setValue(radius);
|
||||
dimension->angle.setValue(static_cast<float>(displayAngle));
|
||||
@@ -1001,10 +1002,9 @@ void PartGui::goDimensionAngularNoTask(const VectorAdapter &vector1Adapter, cons
|
||||
dimension->dColor.setValue(SbColor(0.0, 0.0, 1.0));
|
||||
|
||||
Gui::View3DInventorViewer *viewer = getViewer();
|
||||
if (!viewer)
|
||||
return;
|
||||
|
||||
viewer->addDimension3d(dimension);
|
||||
if (viewer)
|
||||
viewer->addDimension3d(dimension);
|
||||
dimension->unref();
|
||||
}
|
||||
|
||||
SO_KIT_SOURCE(PartGui::DimensionAngular);
|
||||
@@ -1058,6 +1058,7 @@ void PartGui::DimensionAngular::setupDimension()
|
||||
|
||||
//color
|
||||
SoMaterial *material = new SoMaterial;
|
||||
material->ref();
|
||||
material->diffuseColor.connectFrom(&dColor);
|
||||
|
||||
//dimension arrows.
|
||||
@@ -1110,22 +1111,21 @@ void PartGui::DimensionAngular::setupDimension()
|
||||
coordinates->point.connectFrom(&arcEngine->points);
|
||||
|
||||
SoLineSet *lineSet = new SoLineSet();
|
||||
lineSet->ref();
|
||||
lineSet->vertexProperty.setValue(coordinates);
|
||||
lineSet->numVertices.connectFrom(&arcEngine->pointCount);
|
||||
lineSet->startIndex.setValue(0);
|
||||
|
||||
SoSeparator *arcSep = static_cast<SoSeparator *>(getPart("arcSep", true));
|
||||
if (!arcSep)
|
||||
return;
|
||||
arcSep->addChild(material);
|
||||
arcSep->addChild(lineSet);
|
||||
if (arcSep) {
|
||||
arcSep->addChild(material);
|
||||
arcSep->addChild(lineSet);
|
||||
}
|
||||
|
||||
//text
|
||||
SoSeparator *textSep = static_cast<SoSeparator *>(getPart("textSep", true));
|
||||
if (!textSep)
|
||||
return;
|
||||
|
||||
textSep->addChild(material);
|
||||
if (textSep)
|
||||
textSep->addChild(material);
|
||||
|
||||
SoCalculator *textVecCalc = new SoCalculator();
|
||||
textVecCalc->a.connectFrom(&angle);
|
||||
@@ -1158,6 +1158,9 @@ void PartGui::DimensionAngular::setupDimension()
|
||||
SoResetTransform *rTrans = new SoResetTransform;
|
||||
rTrans->whatToReset = SoResetTransform::BBOX;
|
||||
textSep->addChild(rTrans);
|
||||
|
||||
lineSet->unref();
|
||||
material->unref();
|
||||
}
|
||||
|
||||
SO_ENGINE_SOURCE(PartGui::ArcEngine);
|
||||
|
||||
@@ -241,9 +241,9 @@ void ViewProviderPartReference::attach(App::DocumentObject *pcFeat)
|
||||
ViewProviderGeometryObject::attach(pcFeat);
|
||||
|
||||
SoGroup* pcNormalRoot = new SoGroup();
|
||||
SoGroup* pcFlatRoot = new SoGroup();
|
||||
SoGroup* pcWireframeRoot = new SoGroup();
|
||||
SoGroup* pcPointsRoot = new SoGroup();
|
||||
//SoGroup* pcFlatRoot = new SoGroup();
|
||||
//SoGroup* pcWireframeRoot = new SoGroup();
|
||||
//SoGroup* pcPointsRoot = new SoGroup();
|
||||
|
||||
// enable two-side rendering
|
||||
pShapeHints->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE;
|
||||
@@ -256,15 +256,15 @@ void ViewProviderPartReference::attach(App::DocumentObject *pcFeat)
|
||||
pcNormalRoot->addChild(VertexRoot);
|
||||
|
||||
// just faces with no edges or points
|
||||
pcFlatRoot->addChild(pShapeHints);
|
||||
pcFlatRoot->addChild(FaceRoot);
|
||||
//pcFlatRoot->addChild(pShapeHints);
|
||||
//pcFlatRoot->addChild(FaceRoot);
|
||||
|
||||
// only edges
|
||||
pcWireframeRoot->addChild(EdgeRoot);
|
||||
pcWireframeRoot->addChild(VertexRoot);
|
||||
//pcWireframeRoot->addChild(EdgeRoot);
|
||||
//pcWireframeRoot->addChild(VertexRoot);
|
||||
|
||||
// normal viewing with edges and points
|
||||
pcPointsRoot->addChild(VertexRoot);
|
||||
//pcPointsRoot->addChild(VertexRoot);
|
||||
|
||||
// putting all together with the switch
|
||||
addDisplayMaskMode(pcNormalRoot, "Reference");
|
||||
|
||||
@@ -58,6 +58,7 @@ DlgProcessorChooser::DlgProcessorChooser(std::vector<std::string> &scriptnames,
|
||||
|
||||
DlgProcessorChooser::~DlgProcessorChooser()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
std::string DlgProcessorChooser::getProcessor()
|
||||
|
||||
@@ -865,7 +865,7 @@ void BSplineParameterCorrection::DoParameterCorrection(int iIter)
|
||||
fMaxScalar = 1.0;
|
||||
fMaxDiff = 0.0;
|
||||
|
||||
Geom_BSplineSurface* pclBSplineSurf = new Geom_BSplineSurface(_vCtrlPntsOfSurf,
|
||||
Handle(Geom_BSplineSurface) pclBSplineSurf = new Geom_BSplineSurface(_vCtrlPntsOfSurf,
|
||||
_vUKnots, _vVKnots, _vUMults, _vVMults, _usUOrder-1, _usVOrder-1);
|
||||
|
||||
for (int ii=_pvcPoints->Lower();ii <=_pvcPoints->Upper();ii++) {
|
||||
|
||||
@@ -226,17 +226,16 @@ CmdRobotSetDefaultOrientation::CmdRobotSetDefaultOrientation()
|
||||
void CmdRobotSetDefaultOrientation::activated(int)
|
||||
{
|
||||
// create placement dialog
|
||||
Gui::Dialog::Placement *Dlg = new Gui::Dialog::Placement();
|
||||
Gui::Dialog::Placement Dlg;
|
||||
Base::Placement place;
|
||||
Dlg->setPlacement(place);
|
||||
if(Dlg->exec() == QDialog::Accepted ){
|
||||
place = Dlg->getPlacement();
|
||||
Dlg.setPlacement(place);
|
||||
if (Dlg.exec() == QDialog::Accepted ){
|
||||
place = Dlg.getPlacement();
|
||||
Base::Rotation rot = place.getRotation();
|
||||
Base::Vector3d disp = place.getPosition();
|
||||
doCommand(Doc,"_DefOrientation = FreeCAD.Rotation(%f,%f,%f,%f)",rot[0],rot[1],rot[2],rot[3]);
|
||||
doCommand(Doc,"_DefDisplacement = FreeCAD.Vector(%f,%f,%f)",disp[0],disp[1],disp[2]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool CmdRobotSetDefaultOrientation::isActive(void)
|
||||
|
||||
@@ -117,10 +117,10 @@ void TaskRobot6Axis::setRobot(Robot::RobotObject *pcRobotObject)
|
||||
|
||||
void TaskRobot6Axis::createPlacementDlg(void)
|
||||
{
|
||||
Gui::Dialog::Placement *plc = new Gui::Dialog::Placement();
|
||||
plc->setPlacement(pcRobot->Tool.getValue());
|
||||
if(plc->exec()==QDialog::Accepted)
|
||||
pcRobot->Tool.setValue(plc->getPlacement());
|
||||
Gui::Dialog::Placement plc;
|
||||
plc.setPlacement(pcRobot->Tool.getValue());
|
||||
if (plc.exec()==QDialog::Accepted)
|
||||
pcRobot->Tool.setValue(plc.getPlacement());
|
||||
viewTool(pcRobot->Tool.getValue());
|
||||
}
|
||||
|
||||
|
||||
@@ -93,10 +93,10 @@ void TaskTrajectoryDressUpParameter::writeValues(void)
|
||||
|
||||
void TaskTrajectoryDressUpParameter::createPlacementDlg(void)
|
||||
{
|
||||
Gui::Dialog::Placement *plc = new Gui::Dialog::Placement();
|
||||
plc->setPlacement(PosAdd);
|
||||
if(plc->exec()==QDialog::Accepted){
|
||||
PosAdd = plc->getPlacement();
|
||||
Gui::Dialog::Placement plc;
|
||||
plc.setPlacement(PosAdd);
|
||||
if (plc.exec() == QDialog::Accepted) {
|
||||
PosAdd = plc.getPlacement();
|
||||
viewPlacement();
|
||||
}
|
||||
|
||||
|
||||
@@ -60,13 +60,13 @@ ViewProviderRobotObject::ViewProviderRobotObject()
|
||||
{
|
||||
ADD_PROPERTY(Manipulator,(0));
|
||||
|
||||
pcRobotRoot = new Gui::SoFCSelection();
|
||||
pcRobotRoot = new Gui::SoFCSelection();
|
||||
pcRobotRoot->highlightMode = Gui::SoFCSelection::OFF;
|
||||
//pcRobotRoot->selectionMode = Gui::SoFCSelection::SEL_OFF;
|
||||
//pcRobotRoot->style = Gui::SoFCSelection::BOX;
|
||||
pcRobotRoot->ref();
|
||||
|
||||
pcSimpleRoot = new Gui::SoFCSelection();
|
||||
pcSimpleRoot = new Gui::SoFCSelection();
|
||||
pcSimpleRoot->highlightMode = Gui::SoFCSelection::OFF;
|
||||
//pcSimpleRoot->selectionMode = Gui::SoFCSelection::SEL_OFF;
|
||||
pcSimpleRoot->ref();
|
||||
@@ -82,6 +82,14 @@ ViewProviderRobotObject::ViewProviderRobotObject()
|
||||
Axis1Node = Axis2Node = Axis3Node = Axis4Node = Axis5Node = Axis6Node = 0;
|
||||
}
|
||||
|
||||
ViewProviderRobotObject::~ViewProviderRobotObject()
|
||||
{
|
||||
pcRobotRoot->unref();
|
||||
pcSimpleRoot->unref();
|
||||
pcOffRoot->unref();
|
||||
pcTcpRoot->unref();
|
||||
}
|
||||
|
||||
void ViewProviderRobotObject::setDragger()
|
||||
{
|
||||
assert(pcDragger==0);
|
||||
@@ -98,23 +106,13 @@ void ViewProviderRobotObject::setDragger()
|
||||
SbVec3f(150,150,150)
|
||||
);
|
||||
pcDragger->setMotionMatrix(M);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ViewProviderRobotObject::resetDragger()
|
||||
{
|
||||
assert(pcDragger);
|
||||
pcTcpRoot->removeAllChildren();
|
||||
pcDragger = 0;
|
||||
|
||||
}
|
||||
|
||||
ViewProviderRobotObject::~ViewProviderRobotObject()
|
||||
{
|
||||
pcRobotRoot->unref();
|
||||
pcSimpleRoot->unref();
|
||||
pcOffRoot->unref();
|
||||
|
||||
}
|
||||
|
||||
void ViewProviderRobotObject::attach(App::DocumentObject *pcObj)
|
||||
@@ -135,8 +133,6 @@ void ViewProviderRobotObject::attach(App::DocumentObject *pcObj)
|
||||
|
||||
addDisplayMaskMode(pcOffRoot, "Off");
|
||||
pcOffRoot->addChild(pcTcpRoot);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ViewProviderRobotObject::setDisplayMode(const char* ModeName)
|
||||
|
||||
@@ -4865,8 +4865,7 @@ bool SketchObject::increaseBSplineDegree(int GeoId, int degreeincrement /*= 1*/)
|
||||
|
||||
const Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast(bsp->handle());
|
||||
|
||||
Part::GeomBSplineCurve *bspline = new Part::GeomBSplineCurve(curve);
|
||||
|
||||
std::unique_ptr<Part::GeomBSplineCurve> bspline(new Part::GeomBSplineCurve(curve));
|
||||
|
||||
try {
|
||||
int cdegree = bspline->getDegree();
|
||||
@@ -4882,7 +4881,7 @@ bool SketchObject::increaseBSplineDegree(int GeoId, int degreeincrement /*= 1*/)
|
||||
|
||||
std::vector< Part::Geometry * > newVals(vals);
|
||||
|
||||
newVals[GeoId] = bspline;
|
||||
newVals[GeoId] = bspline.release();
|
||||
|
||||
Geometry.setValues(newVals);
|
||||
Constraints.acceptGeometry(getCompleteGeometry());
|
||||
|
||||
@@ -49,7 +49,7 @@ SketchMirrorDialog::SketchMirrorDialog(void)
|
||||
|
||||
SketchMirrorDialog::~SketchMirrorDialog()
|
||||
{
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SketchMirrorDialog::accept()
|
||||
|
||||
@@ -52,7 +52,7 @@ SketchOrientationDialog::SketchOrientationDialog(void)
|
||||
|
||||
SketchOrientationDialog::~SketchOrientationDialog()
|
||||
{
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SketchOrientationDialog::accept()
|
||||
|
||||
@@ -53,7 +53,7 @@ SketchRectangularArrayDialog::SketchRectangularArrayDialog(void)
|
||||
|
||||
SketchRectangularArrayDialog::~SketchRectangularArrayDialog()
|
||||
{
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SketchRectangularArrayDialog::accept()
|
||||
|
||||
@@ -49,7 +49,7 @@ SketcherRegularPolygonDialog::SketcherRegularPolygonDialog(void)
|
||||
|
||||
SketcherRegularPolygonDialog::~SketcherRegularPolygonDialog()
|
||||
{
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SketcherRegularPolygonDialog::accept()
|
||||
|
||||
Reference in New Issue
Block a user