Fix memory leaks

This commit is contained in:
vsr 2009-09-21 13:12:51 +00:00
parent 47d4ddf2b2
commit 56ca7cc409
9 changed files with 67 additions and 77 deletions

View File

@ -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() );

View File

@ -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() );

View File

@ -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;

View File

@ -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() );
}

View File

@ -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());
}

View File

@ -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());

View File

@ -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());
}

View File

@ -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());

View File

@ -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;
}