From: vsr Date: Mon, 21 Sep 2009 13:24:01 +0000 (+0000) Subject: Fix memory leaks X-Git-Tag: V5_1_3rc1~17 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c20be9052a89947a36ccc6693d6723214a31aa1a;p=modules%2Fgeom.git Fix memory leaks --- diff --git a/src/GroupGUI/GroupGUI_GroupDlg.cxx b/src/GroupGUI/GroupGUI_GroupDlg.cxx index 5e5580351..7fc1099f6 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.cxx +++ b/src/GroupGUI/GroupGUI_GroupDlg.cxx @@ -194,14 +194,14 @@ void GroupGUI_GroupDlg::Init() mainFrame()->ResultName->setText( GEOMBase::GetName( myGroup ) ); - GEOM::GEOM_IGroupOperations_var anOp = GEOM::GEOM_IGroupOperations::_narrow( getOperation() ); - myMainObj = anOp->GetMainShape( myGroup ); + GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow( getOperation() ); + myMainObj = anOper->GetMainShape( myGroup ); if ( !CORBA::is_nil( myMainObj ) ) myMainName->setText( GEOMBase::GetName( myMainObj ) ); - setShapeType( (TopAbs_ShapeEnum)anOp->GetType( myGroup ) ); + setShapeType( (TopAbs_ShapeEnum)anOper->GetType( myGroup ) ); - GEOM::ListOfLong_var aCurrList = anOp->GetObjects( myGroup ); + GEOM::ListOfLong_var aCurrList = anOper->GetObjects( myGroup ); for ( int i = 0, n = aCurrList->length(); i < n; i++ ) myIdList->addItem( new QListWidgetItem( QString( "%1" ).arg( aCurrList[i] ) ) ); @@ -1052,25 +1052,25 @@ bool GroupGUI_GroupDlg::execute( ObjectList& objects ) { setInPlaceObj( GEOM::GEOM_Object::_nil() ); - GEOM::GEOM_IGroupOperations_var anOp = GEOM::GEOM_IGroupOperations::_narrow(getOperation()); + GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation()); GEOM::GEOM_Object_var aGroup; if (myMode == CreateGroup) - aGroup = anOp->CreateGroup(myMainObj, getShapeType()); + aGroup = anOper->CreateGroup(myMainObj, getShapeType()); else if (myMode == EditGroup) aGroup = myGroup; - if (CORBA::is_nil(aGroup) || (myMode == CreateGroup && !anOp->IsDone())) + if (CORBA::is_nil(aGroup) || (myMode == CreateGroup && !anOper->IsDone())) return false; - GEOM::ListOfLong_var aCurrList = anOp->GetObjects(aGroup); - if (!anOp->IsDone()) + GEOM::ListOfLong_var aCurrList = anOper->GetObjects(aGroup); + if (!anOper->IsDone()) return false; if (aCurrList->length() > 0) { - anOp->DifferenceIDs(aGroup, aCurrList); - if (!anOp->IsDone()) + anOper->DifferenceIDs(aGroup, aCurrList); + if (!anOper->IsDone()) return false; } @@ -1082,8 +1082,8 @@ bool GroupGUI_GroupDlg::execute( ObjectList& objects ) for (ii = 0; ii < nn; ii++) { aNewList[ii] = myIdList->item(ii)->text().toInt(); } - anOp->UnionIDs(aGroup, aNewList); - if (!anOp->IsDone()) + anOper->UnionIDs(aGroup, aNewList); + if (!anOper->IsDone()) return false; } @@ -1115,8 +1115,8 @@ GEOM::GEOM_Object_ptr GroupGUI_GroupDlg::getFather( GEOM::GEOM_Object_ptr theObj { GEOM::GEOM_Object_var aFatherObj; if ( theObj->GetType() == GEOM_GROUP ) { - GEOM::GEOM_IGroupOperations_var anOp = GEOM::GEOM_IGroupOperations::_narrow( getOperation() ); - aFatherObj = anOp->GetMainShape( theObj ); + GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow( getOperation() ); + aFatherObj = anOper->GetMainShape( theObj ); } return aFatherObj._retn(); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx index ab47b76d3..00f0b3d99 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -448,11 +448,13 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: { if (!CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2)) { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxTwoPnt(myPoint1, myPoint2); + anObj = anOper->MakeBoxTwoPnt(myPoint1, myPoint2); res = true; } } @@ -463,14 +465,14 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects) double y = GroupDimensions->SpinBox_DY->value(); double z = GroupDimensions->SpinBox_DZ->value(); - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxDXDYDZ(x, y, z); + anObj = anOper->MakeBoxDXDYDZ(x, y, z); if (!anObj->_is_nil() && !IsPreview()) { QStringList aParameters; aParameters << GroupDimensions->SpinBox_DX->text(); aParameters << GroupDimensions->SpinBox_DY->text(); aParameters << GroupDimensions->SpinBox_DZ->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; } diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index 5bbe43478..91807dfc6 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -470,32 +470,32 @@ bool PrimitiveGUI_ConeDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeConePntVecR1R2H(myPoint, myDir, getRadius1(), getRadius2(), getHeight()); + anObj = anOper->MakeConePntVecR1R2H(myPoint, myDir, getRadius1(), getRadius2(), getHeight()); if (!anObj->_is_nil() && !IsPreview()) { QStringList aParameters; aParameters << GroupPoints->SpinBox_DX->text(); aParameters << GroupPoints->SpinBox_DY->text(); aParameters << GroupPoints->SpinBox_DZ->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; } break; case 1: - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeConeR1R2H(getRadius1(), getRadius2(), getHeight()); + anObj = anOper->MakeConeR1R2H(getRadius1(), getRadius2(), getHeight()); if (!anObj->_is_nil() && !IsPreview()) { QStringList aParameters; aParameters << GroupDimensions->SpinBox_DX->text(); aParameters << GroupDimensions->SpinBox_DY->text(); aParameters << GroupDimensions->SpinBox_DZ->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index b77bd11a3..b7123270b 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -461,30 +461,30 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeCylinderPntVecRH(myPoint, myDir, getRadius(), getHeight()); + anObj = anOper->MakeCylinderPntVecRH(myPoint, myDir, getRadius(), getHeight()); if (!anObj->_is_nil() && !IsPreview()) { QStringList aParameters; aParameters << GroupPoints->SpinBox_DX->text(); aParameters << GroupPoints->SpinBox_DY->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; } break; case 1: - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeCylinderRH(getRadius(), getHeight()); + anObj = anOper->MakeCylinderRH(getRadius(), getHeight()); if (!anObj->_is_nil() && !IsPreview()) { QStringList aParameters; aParameters << GroupDimensions->SpinBox_DX->text(); aParameters << GroupDimensions->SpinBox_DY->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; diff --git a/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx index 9344092c8..ab40eb1bd 100755 --- a/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx @@ -572,30 +572,29 @@ bool PrimitiveGUI_DiskDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeDiskR(getRadius(), myOrientationType); + anObj = anOper->MakeDiskR(getRadius(), myOrientationType); if (!anObj->_is_nil() && !IsPreview()) { aParameters << GroupDimensions->SpinBox_DX->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; case 1: - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeDiskPntVecR(myPoint, myDir, getRadius()); + anObj = anOper->MakeDiskPntVecR(myPoint, myDir, getRadius()); if (!anObj->_is_nil() && !IsPreview()) { aParameters << GroupPntVecR->SpinBox_DX->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; case 2: - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeDiskThreePnt(myPoint1, myPoint2, myPoint3); + anObj = anOper->MakeDiskThreePnt(myPoint1, myPoint2, myPoint3); res = true; break; } diff --git a/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx index 3f6d5fe6a..49d47717f 100755 --- a/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx @@ -492,31 +492,30 @@ bool PrimitiveGUI_FaceDlg::execute (ObjectList& objects) bool res = false; QStringList aParameters; GEOM::GEOM_Object_var anObj; + + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeFaceHW(GroupDimensions->SpinBox_DX->value(), - GroupDimensions->SpinBox_DY->value(), myOrientationType); + anObj = anOper->MakeFaceHW(GroupDimensions->SpinBox_DX->value(), + GroupDimensions->SpinBox_DY->value(), myOrientationType); if (!anObj->_is_nil() && !IsPreview()) { aParameters << GroupDimensions->SpinBox_DX->text(); aParameters << GroupDimensions->SpinBox_DY->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; case 1: - if (GroupType->RadioButton1->isChecked()) - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeFaceObjHW(myEdge, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value()); - else if (GroupType->RadioButton2->isChecked()) - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeFaceObjHW(myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value()); + anObj = GroupType->RadioButton1->isChecked() ? + anOper->MakeFaceObjHW(myEdge, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value()) : + anOper->MakeFaceObjHW(myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value()); if (!anObj->_is_nil() && !IsPreview()) { aParameters << GroupPlane->SpinBox_DX->text(); aParameters << GroupPlane->SpinBox_DY->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx index 6fc293005..70ad0500b 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -396,16 +396,18 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + switch ( getConstructorId() ) { case 0 : { if ( !CORBA::is_nil( myPoint ) ) { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSpherePntR( myPoint, getRadius() ); + anObj = anOper->MakeSpherePntR( myPoint, getRadius() ); if (!anObj->_is_nil() && !IsPreview()) { QStringList aParameters; aParameters << GroupPoints->SpinBox_DX->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; } @@ -413,12 +415,12 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects ) } case 1 : { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSphereR( getRadius() ); + anObj = anOper->MakeSphereR( getRadius() ); if (!anObj->_is_nil() && !IsPreview()) { QStringList aParameters; aParameters << GroupDimensions->SpinBox_DX->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break; diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx index a756fdf62..849e5d1a9 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -457,30 +457,30 @@ bool PrimitiveGUI_TorusDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + switch (getConstructorId()) { case 0: if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) { - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2()); + anObj = anOper->MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2()); if (!anObj->_is_nil() && !IsPreview()) { QStringList aParameters; aParameters << GroupPoints->SpinBox_DX->text(); aParameters << GroupPoints->SpinBox_DY->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; } break; case 1: - anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> - MakeTorusRR(getRadius1(), getRadius2()); + anObj = anOper->MakeTorusRR(getRadius1(), getRadius2()); if (!anObj->_is_nil() && !IsPreview()) { QStringList aParameters; aParameters << GroupDimensions->SpinBox_DX->text(); aParameters << GroupDimensions->SpinBox_DY->text(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); } res = true; break;