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; 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() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );

View File

@ -1481,15 +1481,15 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
WPlane[7] = myWPlane.XDirection().Y(); WPlane[7] = myWPlane.XDirection().Y();
WPlane[8] = myWPlane.XDirection().Z(); WPlane[8] = myWPlane.XDirection().Z();
GEOM::GEOM_Object_var anObj = GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation());
GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeSketcher( cmd.toLatin1(), WPlane ); GEOM::GEOM_Object_var anObj = anOper->MakeSketcher( cmd.toLatin1().constData(), WPlane );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
{ {
if( !IsPreview() ) { if( !IsPreview() ) {
QStringList aCurrentParameters = myParameters; QStringList aCurrentParameters = myParameters;
aCurrentParameters << aParameters; aCurrentParameters << aParameters;
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aCurrentParameters)); anObj->SetParameters(aCurrentParameters.join(":").toLatin1().constData());
} }
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );

View File

@ -558,8 +558,8 @@ bool EntityGUI_SubShapeDlg::isValid (QString& msg)
//================================================================================= //=================================================================================
bool EntityGUI_SubShapeDlg::execute (ObjectList& objects) bool EntityGUI_SubShapeDlg::execute (ObjectList& objects)
{ {
GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow(getOperation())-> GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
MakeExplode(myObject, shapeType(), true); GEOM::ListOfGO_var aList = anOper->MakeExplode(myObject, shapeType(), true);
if (!aList->length()) if (!aList->length())
return false; return false;

View File

@ -264,14 +264,12 @@ bool OperationGUI_ArchimedeDlg::isValid( QString& msg )
//================================================================================= //=================================================================================
bool OperationGUI_ArchimedeDlg::execute( ObjectList& objects ) bool OperationGUI_ArchimedeDlg::execute( ObjectList& objects )
{ {
GEOM::GEOM_Object_var anObj;
double aWeight = GroupPoints->SpinBox_DX->value(); double aWeight = GroupPoints->SpinBox_DX->value();
double aWaterDensity = GroupPoints->SpinBox_DY->value(); double aWaterDensity = GroupPoints->SpinBox_DY->value();
double aMeshDeflection = GroupPoints->SpinBox_DZ->value(); double aMeshDeflection = GroupPoints->SpinBox_DZ->value();
anObj = GEOM::GEOM_ILocalOperations::_narrow( GEOM::GEOM_ILocalOperations_var anOper = GEOM::GEOM_ILocalOperations::_narrow(getOperation());
getOperation() )->MakeArchimede( myShape, aWeight, aWaterDensity, aMeshDeflection ); GEOM::GEOM_Object_var anObj = anOper->MakeArchimede( myShape, aWeight, aWaterDensity, aMeshDeflection );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
{ {
@ -281,7 +279,7 @@ bool OperationGUI_ArchimedeDlg::execute( ObjectList& objects )
aParameters << GroupPoints->SpinBox_DX->text(); aParameters << GroupPoints->SpinBox_DX->text();
aParameters << GroupPoints->SpinBox_DY->text(); aParameters << GroupPoints->SpinBox_DY->text();
aParameters << GroupPoints->SpinBox_DZ->text(); aParameters << GroupPoints->SpinBox_DZ->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); anObj->SetParameters(aParameters.join(":").toLatin1().constData());
} }
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }

View File

@ -801,16 +801,17 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
myRadioButton[ RadioButton41 ]->isChecked()); myRadioButton[ RadioButton41 ]->isChecked());
int anId = getConstructorId(); int anId = getConstructorId();
GEOM::GEOM_ILocalOperations_var anOper = GEOM::GEOM_ILocalOperations::_narrow(getOperation());
if (anId == 0) { if (anId == 0) {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> anObj = anOper->MakeChamferAll(myShape, mySpinBox[ SpinBox1 ]->value());
MakeChamferAll(myShape, mySpinBox[ SpinBox1 ]->value());
if (!anObj->_is_nil()) if (!anObj->_is_nil())
aParameters << mySpinBox[ SpinBox1 ]->text(); aParameters << mySpinBox[ SpinBox1 ]->text();
} }
else if (anId == 1) { else if (anId == 1) {
if (flag) { if (flag) {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> anObj = anOper->MakeChamferEdge(myShape,
MakeChamferEdge(myShape,
mySpinBox[ SpinBox21 ]->value(), mySpinBox[ SpinBox21 ]->value(),
mySpinBox[ SpinBox22 ]->value(), mySpinBox[ SpinBox22 ]->value(),
myFace[ Face1 ], myFace[ Face1 ],
@ -822,8 +823,7 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
} }
} }
else { else {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> anObj = anOper->MakeChamferEdgeAD(myShape,
MakeChamferEdgeAD(myShape,
mySpinBox[ SpinBox23 ]->value(), mySpinBox[ SpinBox23 ]->value(),
mySpinBox[ SpinBox24 ]->value() * PI180, mySpinBox[ SpinBox24 ]->value() * PI180,
myFace[ Face1 ], myFace[ Face1 ],
@ -844,8 +844,7 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
anArray[ i - 1 ] = myFaces(i); anArray[ i - 1 ] = myFaces(i);
if (flag) { if (flag) {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> anObj = anOper->MakeChamferFaces(myShape,
MakeChamferFaces(myShape,
mySpinBox[ SpinBox31 ]->value(), mySpinBox[ SpinBox31 ]->value(),
mySpinBox[ SpinBox32 ]->value(), mySpinBox[ SpinBox32 ]->value(),
anArray); anArray);
@ -856,8 +855,7 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
} }
} }
else { else {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> anObj = anOper->MakeChamferFacesAD(myShape,
MakeChamferFacesAD(myShape,
mySpinBox[ SpinBox33 ]->value(), mySpinBox[ SpinBox33 ]->value(),
mySpinBox[ SpinBox34 ]->value() * PI180, mySpinBox[ SpinBox34 ]->value() * PI180,
anArray); anArray);
@ -874,8 +872,7 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
for (int i = 1, n = myEdges.Extent(); i <= n; i++) for (int i = 1, n = myEdges.Extent(); i <= n; i++)
anArray[ i - 1 ] = myEdges(i); anArray[ i - 1 ] = myEdges(i);
if (flag) { if (flag) {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> anObj = anOper->MakeChamferEdges(myShape,
MakeChamferEdges(myShape,
mySpinBox[ SpinBox41 ]->value(), mySpinBox[ SpinBox41 ]->value(),
mySpinBox[ SpinBox42 ]->value(), mySpinBox[ SpinBox42 ]->value(),
anArray); anArray);
@ -886,8 +883,7 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
} }
} }
else { else {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> anObj = anOper->MakeChamferEdgesAD(myShape,
MakeChamferEdgesAD(myShape,
mySpinBox[ SpinBox43 ]->value(), mySpinBox[ SpinBox43 ]->value(),
mySpinBox[ SpinBox44 ]->value() * PI180, mySpinBox[ SpinBox44 ]->value() * PI180,
anArray); anArray);
@ -902,7 +898,7 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
if (!anObj->_is_nil()) if (!anObj->_is_nil())
{ {
if (!IsPreview()) if (!IsPreview())
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); anObj->SetParameters(aParameters.join(":").toLatin1().constData());
objects.push_back(anObj._retn()); objects.push_back(anObj._retn());
} }

View File

@ -381,18 +381,16 @@ bool OperationGUI_Fillet1d2dDlg::isValid (QString&)
//================================================================================= //=================================================================================
bool OperationGUI_Fillet1d2dDlg::execute (ObjectList& objects) bool OperationGUI_Fillet1d2dDlg::execute (ObjectList& objects)
{ {
GEOM::GEOM_Object_var anObj;
GEOM::ListOfLong_var aListOfIndexes = new GEOM::ListOfLong; GEOM::ListOfLong_var aListOfIndexes = new GEOM::ListOfLong;
aListOfIndexes->length(myVertexes.Extent()); aListOfIndexes->length(myVertexes.Extent());
for (int i = 1, n = myVertexes.Extent(); i <= n; i++) for (int i = 1, n = myVertexes.Extent(); i <= n; i++)
aListOfIndexes[ i - 1 ] = myVertexes(i); aListOfIndexes[ i - 1 ] = myVertexes(i);
GEOM::GEOM_ILocalOperations_ptr op = GEOM::GEOM_ILocalOperations_var anOper = GEOM::GEOM_ILocalOperations::_narrow(getOperation());
GEOM::GEOM_ILocalOperations::_narrow(getOperation()); GEOM::GEOM_Object_var anObj = myIs1D ?
anObj = (myIs1D ? op->MakeFillet1D(myShape, getRadius(), aListOfIndexes) anOper->MakeFillet1D(myShape, getRadius(), aListOfIndexes) :
: op->MakeFillet2D(myShape, getRadius(), aListOfIndexes)); anOper->MakeFillet2D(myShape, getRadius(), aListOfIndexes);
if (!anObj->_is_nil()) if (!anObj->_is_nil())
objects.push_back(anObj._retn()); objects.push_back(anObj._retn());

View File

@ -626,9 +626,11 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects)
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
int anId = getConstructorId(); int anId = getConstructorId();
GEOM::GEOM_ILocalOperations_var anOper = GEOM::GEOM_ILocalOperations::_narrow(getOperation());
if (anId == 0) { if (anId == 0) {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> anObj = anOper->MakeFilletAll(myShape, getRadius());
MakeFilletAll(myShape, getRadius());
if (!anObj->_is_nil()) if (!anObj->_is_nil())
aParameters << Group1->SpinBox_DX->text(); aParameters << Group1->SpinBox_DX->text();
} }
@ -641,15 +643,13 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects)
if (Group2->RadioButton1->isChecked()) if (Group2->RadioButton1->isChecked())
{ {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> anObj = anOper->MakeFilletEdges(myShape, getRadius(), aList);
MakeFilletEdges(myShape, getRadius(), aList);
if (!anObj->_is_nil()) if (!anObj->_is_nil())
aParameters << Group2->SpinBox_DX->text(); aParameters << Group2->SpinBox_DX->text();
} }
else else
{ {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> anObj = anOper->MakeFilletEdgesR1R2(myShape,
MakeFilletEdgesR1R2(myShape,
Group2->SpinBox_DY->value(), Group2->SpinBox_DY->value(),
Group2->SpinBox_DZ->value(), Group2->SpinBox_DZ->value(),
aList); aList);
@ -668,14 +668,12 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects)
aList[ i - 1 ] = myFaces(i); aList[ i - 1 ] = myFaces(i);
if (Group3->RadioButton1->isChecked()) { if (Group3->RadioButton1->isChecked()) {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> anObj = anOper->MakeFilletFaces(myShape, getRadius(), aList);
MakeFilletFaces(myShape, getRadius(), aList);
if (!anObj->_is_nil()) if (!anObj->_is_nil())
aParameters << Group3->SpinBox_DX->text(); aParameters << Group3->SpinBox_DX->text();
} }
else { else {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> anObj = anOper->MakeFilletFacesR1R2(myShape,
MakeFilletFacesR1R2(myShape,
Group3->SpinBox_DY->value(), Group3->SpinBox_DY->value(),
Group3->SpinBox_DZ->value(), aList); Group3->SpinBox_DZ->value(), aList);
if (!anObj->_is_nil()) if (!anObj->_is_nil())
@ -689,7 +687,7 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects)
if (!anObj->_is_nil()) if (!anObj->_is_nil())
{ {
if (!IsPreview()) if (!IsPreview())
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); anObj->SetParameters(aParameters.join(":").toLatin1().constData());
objects.push_back(anObj._retn()); objects.push_back(anObj._retn());
} }

View File

@ -331,9 +331,8 @@ bool OperationGUI_GetShapesOnShapeDlg::execute (ObjectList& objects)
default: break; default: break;
} }
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
GEOM::GEOM_IShapesOperations::_narrow(getOperation())-> GEOM::GEOM_Object_var anObj = anOper->GetShapesOnShapeAsCompound(myObject2, myObject1,
GetShapesOnShapeAsCompound(myObject2, myObject1,
(CORBA::Short) aLimit, (CORBA::Short) aLimit,
aState); aState);

View File

@ -401,8 +401,8 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects )
} }
if ( isValid( msg ) ) { if ( isValid( msg ) ) {
anObj = GEOM::GEOM_IBooleanOperations::_narrow( getOperation() )-> GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
MakePartition( myListShapes, myListTools, anObj = anOper->MakePartition( myListShapes, myListTools,
myListKeepInside, myListRemoveInside, myListKeepInside, myListRemoveInside,
aLimit, false, myListMaterials, aKeepNonlimitShapes ); aLimit, false, myListMaterials, aKeepNonlimitShapes );
res = true; res = true;