From: vsr Date: Mon, 21 Sep 2009 13:12:51 +0000 (+0000) Subject: Fix memory leaks X-Git-Tag: V5_1_3rc1~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=56ca7cc4091fd08893cdecf33991b74298eed640;p=modules%2Fgeom.git Fix memory leaks --- diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx index 286953f6c..1152b7f3e 100755 --- a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx @@ -446,7 +446,8 @@ bool EntityGUI_3DSketcherDlg::execute( ObjectList& objects ) aCoordsArray[i+2] = z; } - GEOM::GEOM_Object_var anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->Make3DSketcher( aCoordsArray ); + GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = anOper->Make3DSketcher( aCoordsArray ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index d2b0db330..0ffb81344 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -1481,15 +1481,15 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) WPlane[7] = myWPlane.XDirection().Y(); WPlane[8] = myWPlane.XDirection().Z(); - GEOM::GEOM_Object_var anObj = - GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeSketcher( cmd.toLatin1(), WPlane ); + GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = anOper->MakeSketcher( cmd.toLatin1().constData(), WPlane ); if ( !anObj->_is_nil() ) { if( !IsPreview() ) { QStringList aCurrentParameters = myParameters; aCurrentParameters << aParameters; - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aCurrentParameters)); + anObj->SetParameters(aCurrentParameters.join(":").toLatin1().constData()); } objects.push_back( anObj._retn() ); diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx index 45e27d2e7..9dc4679bf 100644 --- a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx @@ -558,8 +558,8 @@ bool EntityGUI_SubShapeDlg::isValid (QString& msg) //================================================================================= bool EntityGUI_SubShapeDlg::execute (ObjectList& objects) { - GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow(getOperation())-> - MakeExplode(myObject, shapeType(), true); + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation()); + GEOM::ListOfGO_var aList = anOper->MakeExplode(myObject, shapeType(), true); if (!aList->length()) return false; diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx index 96840b012..f1c646c57 100644 --- a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx @@ -264,14 +264,12 @@ bool OperationGUI_ArchimedeDlg::isValid( QString& msg ) //================================================================================= bool OperationGUI_ArchimedeDlg::execute( ObjectList& objects ) { - GEOM::GEOM_Object_var anObj; - double aWeight = GroupPoints->SpinBox_DX->value(); double aWaterDensity = GroupPoints->SpinBox_DY->value(); double aMeshDeflection = GroupPoints->SpinBox_DZ->value(); - anObj = GEOM::GEOM_ILocalOperations::_narrow( - getOperation() )->MakeArchimede( myShape, aWeight, aWaterDensity, aMeshDeflection ); + GEOM::GEOM_ILocalOperations_var anOper = GEOM::GEOM_ILocalOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = anOper->MakeArchimede( myShape, aWeight, aWaterDensity, aMeshDeflection ); if ( !anObj->_is_nil() ) { @@ -281,7 +279,7 @@ bool OperationGUI_ArchimedeDlg::execute( ObjectList& objects ) 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()); } objects.push_back( anObj._retn() ); } diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.cxx b/src/OperationGUI/OperationGUI_ChamferDlg.cxx index af89feddd..ba19442f0 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.cxx +++ b/src/OperationGUI/OperationGUI_ChamferDlg.cxx @@ -801,20 +801,21 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) myRadioButton[ RadioButton41 ]->isChecked()); int anId = getConstructorId(); + + GEOM::GEOM_ILocalOperations_var anOper = GEOM::GEOM_ILocalOperations::_narrow(getOperation()); + if (anId == 0) { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferAll(myShape, mySpinBox[ SpinBox1 ]->value()); + anObj = anOper->MakeChamferAll(myShape, mySpinBox[ SpinBox1 ]->value()); if (!anObj->_is_nil()) aParameters << mySpinBox[ SpinBox1 ]->text(); } else if (anId == 1) { if (flag) { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferEdge(myShape, - mySpinBox[ SpinBox21 ]->value(), - mySpinBox[ SpinBox22 ]->value(), - myFace[ Face1 ], - myFace[ Face2 ]); + anObj = anOper->MakeChamferEdge(myShape, + mySpinBox[ SpinBox21 ]->value(), + mySpinBox[ SpinBox22 ]->value(), + myFace[ Face1 ], + myFace[ Face2 ]); if (!anObj->_is_nil()) { aParameters << mySpinBox[ SpinBox21 ]->text(); @@ -822,12 +823,11 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) } } else { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferEdgeAD(myShape, - mySpinBox[ SpinBox23 ]->value(), - mySpinBox[ SpinBox24 ]->value() * PI180, - myFace[ Face1 ], - myFace[ Face2 ]); + anObj = anOper->MakeChamferEdgeAD(myShape, + mySpinBox[ SpinBox23 ]->value(), + mySpinBox[ SpinBox24 ]->value() * PI180, + myFace[ Face1 ], + myFace[ Face2 ]); if (!anObj->_is_nil()) { aParameters << mySpinBox[ SpinBox23 ]->text(); @@ -844,11 +844,10 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) anArray[ i - 1 ] = myFaces(i); if (flag) { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferFaces(myShape, - mySpinBox[ SpinBox31 ]->value(), - mySpinBox[ SpinBox32 ]->value(), - anArray); + anObj = anOper->MakeChamferFaces(myShape, + mySpinBox[ SpinBox31 ]->value(), + mySpinBox[ SpinBox32 ]->value(), + anArray); if (!anObj->_is_nil()) { aParameters << mySpinBox[ SpinBox31 ]->text(); @@ -856,11 +855,10 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) } } else { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferFacesAD(myShape, - mySpinBox[ SpinBox33 ]->value(), - mySpinBox[ SpinBox34 ]->value() * PI180, - anArray); + anObj = anOper->MakeChamferFacesAD(myShape, + mySpinBox[ SpinBox33 ]->value(), + mySpinBox[ SpinBox34 ]->value() * PI180, + anArray); if (!anObj->_is_nil()) { aParameters << mySpinBox[ SpinBox33 ]->text(); @@ -874,11 +872,10 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) for (int i = 1, n = myEdges.Extent(); i <= n; i++) anArray[ i - 1 ] = myEdges(i); if (flag) { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferEdges(myShape, - mySpinBox[ SpinBox41 ]->value(), - mySpinBox[ SpinBox42 ]->value(), - anArray); + anObj = anOper->MakeChamferEdges(myShape, + mySpinBox[ SpinBox41 ]->value(), + mySpinBox[ SpinBox42 ]->value(), + anArray); if (!anObj->_is_nil()) { aParameters << mySpinBox[ SpinBox41 ]->text(); @@ -886,11 +883,10 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) } } else { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferEdgesAD(myShape, - mySpinBox[ SpinBox43 ]->value(), - mySpinBox[ SpinBox44 ]->value() * PI180, - anArray); + anObj = anOper->MakeChamferEdgesAD(myShape, + mySpinBox[ SpinBox43 ]->value(), + mySpinBox[ SpinBox44 ]->value() * PI180, + anArray); if (!anObj->_is_nil()) { aParameters << mySpinBox[ SpinBox43 ]->text(); @@ -902,7 +898,7 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) if (!anObj->_is_nil()) { if (!IsPreview()) - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); objects.push_back(anObj._retn()); } diff --git a/src/OperationGUI/OperationGUI_Fillet1d2dDlg.cxx b/src/OperationGUI/OperationGUI_Fillet1d2dDlg.cxx index 43671b149..d3220fed8 100644 --- a/src/OperationGUI/OperationGUI_Fillet1d2dDlg.cxx +++ b/src/OperationGUI/OperationGUI_Fillet1d2dDlg.cxx @@ -381,18 +381,16 @@ bool OperationGUI_Fillet1d2dDlg::isValid (QString&) //================================================================================= bool OperationGUI_Fillet1d2dDlg::execute (ObjectList& objects) { - GEOM::GEOM_Object_var anObj; - GEOM::ListOfLong_var aListOfIndexes = new GEOM::ListOfLong; aListOfIndexes->length(myVertexes.Extent()); for (int i = 1, n = myVertexes.Extent(); i <= n; i++) aListOfIndexes[ i - 1 ] = myVertexes(i); - GEOM::GEOM_ILocalOperations_ptr op = - GEOM::GEOM_ILocalOperations::_narrow(getOperation()); - anObj = (myIs1D ? op->MakeFillet1D(myShape, getRadius(), aListOfIndexes) - : op->MakeFillet2D(myShape, getRadius(), aListOfIndexes)); + GEOM::GEOM_ILocalOperations_var anOper = GEOM::GEOM_ILocalOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = myIs1D ? + anOper->MakeFillet1D(myShape, getRadius(), aListOfIndexes) : + anOper->MakeFillet2D(myShape, getRadius(), aListOfIndexes); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); diff --git a/src/OperationGUI/OperationGUI_FilletDlg.cxx b/src/OperationGUI/OperationGUI_FilletDlg.cxx index 84a2f3134..e6986bf03 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.cxx +++ b/src/OperationGUI/OperationGUI_FilletDlg.cxx @@ -626,9 +626,11 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; int anId = getConstructorId(); + + GEOM::GEOM_ILocalOperations_var anOper = GEOM::GEOM_ILocalOperations::_narrow(getOperation()); + if (anId == 0) { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeFilletAll(myShape, getRadius()); + anObj = anOper->MakeFilletAll(myShape, getRadius()); if (!anObj->_is_nil()) aParameters << Group1->SpinBox_DX->text(); } @@ -641,18 +643,16 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects) if (Group2->RadioButton1->isChecked()) { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeFilletEdges(myShape, getRadius(), aList); + anObj = anOper->MakeFilletEdges(myShape, getRadius(), aList); if (!anObj->_is_nil()) aParameters << Group2->SpinBox_DX->text(); } else { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeFilletEdgesR1R2(myShape, - Group2->SpinBox_DY->value(), - Group2->SpinBox_DZ->value(), - aList); + anObj = anOper->MakeFilletEdgesR1R2(myShape, + Group2->SpinBox_DY->value(), + Group2->SpinBox_DZ->value(), + aList); if (!anObj->_is_nil()) { aParameters << Group2->SpinBox_DY->text(); @@ -668,16 +668,14 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects) aList[ i - 1 ] = myFaces(i); if (Group3->RadioButton1->isChecked()) { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeFilletFaces(myShape, getRadius(), aList); + anObj = anOper->MakeFilletFaces(myShape, getRadius(), aList); if (!anObj->_is_nil()) aParameters << Group3->SpinBox_DX->text(); } else { - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeFilletFacesR1R2(myShape, - Group3->SpinBox_DY->value(), - Group3->SpinBox_DZ->value(), aList); + anObj = anOper->MakeFilletFacesR1R2(myShape, + Group3->SpinBox_DY->value(), + Group3->SpinBox_DZ->value(), aList); if (!anObj->_is_nil()) { aParameters << Group3->SpinBox_DY->text(); @@ -689,7 +687,7 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects) if (!anObj->_is_nil()) { if (!IsPreview()) - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); objects.push_back(anObj._retn()); } diff --git a/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.cxx b/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.cxx index 70e011f7a..729e46f58 100644 --- a/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.cxx +++ b/src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.cxx @@ -331,11 +331,10 @@ bool OperationGUI_GetShapesOnShapeDlg::execute (ObjectList& objects) default: break; } - GEOM::GEOM_Object_var anObj = - GEOM::GEOM_IShapesOperations::_narrow(getOperation())-> - GetShapesOnShapeAsCompound(myObject2, myObject1, - (CORBA::Short) aLimit, - aState); + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation()); + GEOM::GEOM_Object_var anObj = anOper->GetShapesOnShapeAsCompound(myObject2, myObject1, + (CORBA::Short) aLimit, + aState); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.cxx b/src/OperationGUI/OperationGUI_PartitionDlg.cxx index 0b10ca391..f79ede15e 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.cxx +++ b/src/OperationGUI/OperationGUI_PartitionDlg.cxx @@ -401,10 +401,10 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects ) } if ( isValid( msg ) ) { - anObj = GEOM::GEOM_IBooleanOperations::_narrow( getOperation() )-> - MakePartition( myListShapes, myListTools, - myListKeepInside, myListRemoveInside, - aLimit, false, myListMaterials, aKeepNonlimitShapes ); + GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation()); + anObj = anOper->MakePartition( myListShapes, myListTools, + myListKeepInside, myListRemoveInside, + aLimit, false, myListMaterials, aKeepNonlimitShapes ); res = true; }