Fix memory leaks problem

This commit is contained in:
vsr 2009-09-21 11:38:02 +00:00
parent 1ba0a9935e
commit f65909a2fb
16 changed files with 65 additions and 67 deletions

View File

@ -355,10 +355,9 @@ bool GenerationGUI_FillingDlg::isValid( QString& msg )
//=================================================================================
bool GenerationGUI_FillingDlg::execute( ObjectList& objects )
{
GEOM::GEOM_Object_var anObj;
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation() )->MakeFilling(
myCompound, myMinDeg, myMaxDeg, myTol2D, myTol3D, myNbIter, myIsApprox );
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
GEOM::GEOM_Object_var anObj = anOper->MakeFilling( myCompound, myMinDeg, myMaxDeg,
myTol2D, myTol3D, myNbIter, myIsApprox );
if ( !anObj->_is_nil() )
{
if ( !IsPreview() )
@ -369,7 +368,7 @@ bool GenerationGUI_FillingDlg::execute( ObjectList& objects )
aParameters << GroupPoints->SpinBox3->text();
aParameters << GroupPoints->SpinBox4->text();
aParameters << GroupPoints->SpinBox5->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
}
objects.push_back( anObj._retn() );
}

View File

@ -475,13 +475,14 @@ bool GenerationGUI_PipeDlg::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())->MakePipe(myBase, myPath);
anObj = anOper->MakePipe(myBase, myPath);
break;
case 1 :
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakePipeBiNormalAlongVector(myBase, myPath, myVec);
anObj = anOper->MakePipeBiNormalAlongVector(myBase, myPath, myVec);
break;
}

View File

@ -653,32 +653,30 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
QStringList aParameters;
GEOM::GEOM_Object_var anObj;
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
switch (getConstructorId()) {
case 0:
if (!myBothway) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakePrismVecH(myBase, myVec, getHeight());
anObj = anOper->MakePrismVecH(myBase, myVec, getHeight());
}
else {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakePrismVecH2Ways(myBase, myVec, getHeight());
anObj = anOper->MakePrismVecH2Ways(myBase, myVec, getHeight());
}
if (!anObj->_is_nil() && !IsPreview())
{
aParameters << GroupPoints->SpinBox_DX->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
}
break;
case 1:
if (!myBothway2) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakePrismTwoPnt(myBase, myPoint1, myPoint2);
anObj = anOper->MakePrismTwoPnt(myBase, myPoint1, myPoint2);
}
else {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakePrismTwoPnt2Ways(myBase, myPoint1, myPoint2);
anObj = anOper->MakePrismTwoPnt2Ways(myBase, myPoint1, myPoint2);
}
break;
case 2:
@ -687,12 +685,10 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
double dz = GroupPoints3->SpinBox_DZ->value();
if (!myBothway3) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakePrismDXDYDZ(myBase, dx, dy, dz);
anObj = anOper->MakePrismDXDYDZ(myBase, dx, dy, dz);
}
else {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakePrismDXDYDZ2Ways(myBase, dx, dy, dz);
anObj = anOper->MakePrismDXDYDZ2Ways(myBase, dx, dy, dz);
}
if (!anObj->_is_nil() && !IsPreview())
@ -700,7 +696,7 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
aParameters << GroupPoints3->SpinBox_DX->text();
aParameters << GroupPoints3->SpinBox_DY->text();
aParameters << GroupPoints3->SpinBox_DZ->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
}
break;

View File

@ -405,13 +405,13 @@ bool GenerationGUI_RevolDlg::execute (ObjectList& objects)
{
GEOM::GEOM_Object_var anObj;
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
if (!myBothway) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeRevolutionAxisAngle(myBase, myAxis, getAngle() * PI180);
anObj = anOper->MakeRevolutionAxisAngle(myBase, myAxis, getAngle() * PI180);
}
else {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeRevolutionAxisAngle2Ways(myBase, myAxis, getAngle() * PI180);
anObj = anOper->MakeRevolutionAxisAngle2Ways(myBase, myAxis, getAngle() * PI180);
}
if (!anObj->_is_nil())
@ -420,7 +420,7 @@ bool GenerationGUI_RevolDlg::execute (ObjectList& objects)
{
QStringList aParameters;
aParameters << GroupPoints->SpinBox_DX->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
}
objects.push_back(anObj._retn());
}

View File

@ -269,11 +269,12 @@ bool RepairGUI_ChangeOrientationDlg::execute( ObjectList& objects )
bool toCreateCopy = GroupPoints->CheckButton1->isChecked();
GEOM::GEOM_Object_var anObj;
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() );
if ( toCreateCopy ) {
anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->ChangeOrientationCopy( myObject );
anObj = anOper->ChangeOrientationCopy( myObject );
}
else {
anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->ChangeOrientation( myObject );
anObj = anOper->ChangeOrientation( myObject );
}
if ( !anObj->_is_nil() )

View File

@ -319,8 +319,8 @@ bool RepairGUI_CloseContourDlg::isValid (QString&)
//=================================================================================
bool RepairGUI_CloseContourDlg::execute (ObjectList& objects)
{
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow(getOperation())->
CloseContour(myObject, myWiresInd, getIsByVertex());
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
GEOM::GEOM_Object_var anObj = anOper->CloseContour(myObject, myWiresInd, getIsByVertex());
bool aResult = !anObj->_is_nil();
if (aResult)

View File

@ -362,8 +362,8 @@ bool RepairGUI_DivideEdgeDlg::isValid( QString& msg )
//=================================================================================
bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects )
{
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->DivideEdge
( myObject, myIndex, myValEdt->value(), getIsByParameter() );
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() );
GEOM::GEOM_Object_var anObj = anOper->DivideEdge( myObject, myIndex, myValEdt->value(), getIsByParameter() );
bool aResult = !anObj->_is_nil();
if ( aResult )
{
@ -373,7 +373,7 @@ bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects )
aParameters << "";
aParameters << myValEdt->text();
aParameters << "";
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
}
objects.push_back( anObj._retn() );
}

View File

@ -293,8 +293,8 @@ bool RepairGUI_FreeBoundDlg::execute( ObjectList& objects )
GEOM::ListOfGO_var aClosed, anOpen;
bool result = GEOM::GEOM_IHealingOperations::_narrow(
getOperation() )->GetFreeBoundary( myObj, aClosed, anOpen );
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() );
bool result = anOper->GetFreeBoundary( myObj, aClosed, anOpen );
if ( result ) {
myNbClosed = aClosed->length();

View File

@ -307,8 +307,8 @@ bool RepairGUI_FreeFacesDlg::isValid( QString& )
bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects )
{
bool aResult = false;
GEOM::ListOfLong_var aFaceLst =
GEOM::GEOM_IShapesOperations::_narrow( getOperation() )->GetFreeFacesIDs( myObj );
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
GEOM::ListOfLong_var aFaceLst = anOper->GetFreeFacesIDs( myObj );
TopoDS_Shape aSelShape;
TopoDS_Shape aFace;
TopTools_IndexedMapOfShape anIndices;

View File

@ -407,17 +407,17 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
bool aResult = false;
objects.clear();
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
switch ( getConstructorId() ) {
case 0:
{
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow
( getOperation() )->MakeGlueFaces( myObject, myTolEdt->value(), true );
GEOM::GEOM_Object_var anObj = anOper->MakeGlueFaces( myObject, myTolEdt->value(), true );
aResult = !anObj->_is_nil();
if ( aResult && !IsPreview() )
{
QStringList aParameters;
aParameters << myTolEdt->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
objects.push_back( anObj._retn() );
}
@ -461,8 +461,7 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
ObjectList::iterator anIter3 = toGlue.begin();
for ( int i = 0; anIter3 != toGlue.end(); ++anIter3, ++i )
aListForGlue[ i ] = *anIter3;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow
( getOperation() )->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue, true );
GEOM::GEOM_Object_var anObj = anOper->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue, true );
aResult = !anObj->_is_nil();
@ -472,7 +471,7 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
{
QStringList aParameters;
aParameters << myTolEdt2->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
}
objects.push_back( anObj._retn() );
}
@ -607,12 +606,11 @@ bool RepairGUI_GlueDlg::onAcceptLocal()
}
// JFA 28.12.2004 BEGIN // To enable warnings
if ( !getOperation()->_is_nil() ) {
if ( !getOperation()->IsDone() ) {
wc.suspend();
QString msgw = QObject::tr( getOperation()->GetErrorCode() );
SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), msgw, tr( "BUT_OK" ) );
}
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
if ( !CORBA::is_nil(anOper) && !anOper->IsDone() ) {
wc.suspend();
QString msgw = QObject::tr( anOper->GetErrorCode() );
SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), msgw, tr( "BUT_OK" ) );
}
// JFA 28.12.2004 END
}
@ -648,8 +646,8 @@ void RepairGUI_GlueDlg::onDetect()
buttonApply()->setEnabled( false );
globalSelection( GEOM_ALLSHAPES );
GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow
( getOperation() )->GetGlueFaces( myObject, myTolEdt2->value() );
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
GEOM::ListOfGO_var aList = anOper->GetGlueFaces( myObject, myTolEdt2->value() );
for ( int i = 0, n = aList->length(); i < n; i++ )
myTmpObjs.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));

View File

@ -288,8 +288,8 @@ bool RepairGUI_RemoveExtraEdgesDlg::execute( ObjectList& objects )
int nbFacesOptimum = -1; // -1 means do not union faces
if (GroupPoints->CheckButton1->isChecked())
nbFacesOptimum = 0; // 0 means union all faces, that possible
anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->RemoveExtraEdges
(myObject, nbFacesOptimum);
GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow(getOperation());
anObj = anOper->RemoveExtraEdges(myObject, nbFacesOptimum);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());

View File

@ -329,8 +329,8 @@ bool RepairGUI_RemoveHolesDlg::execute (ObjectList& objects)
// highlight them (add to objects), display message dialog
GEOM::ListOfGO_var aClosed, anOpen;
aResult = GEOM::GEOM_IHealingOperations::_narrow(getOperation())->
GetFreeBoundary(myObject, aClosed, anOpen);
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
aResult = anOper->GetFreeBoundary(myObject, aClosed, anOpen);
if (aResult) {
myClosed = aClosed->length();
@ -345,8 +345,8 @@ bool RepairGUI_RemoveHolesDlg::execute (ObjectList& objects)
myClosed = -1;
}
else {
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow(getOperation())->
FillHoles(myObject, myWiresInd);
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
GEOM::GEOM_Object_var anObj = anOper->FillHoles(myObject, myWiresInd);
aResult = !anObj->_is_nil();
if (aResult)
objects.push_back(anObj._retn());

View File

@ -306,8 +306,8 @@ bool RepairGUI_RemoveIntWiresDlg::isValid (QString&)
//=================================================================================
bool RepairGUI_RemoveIntWiresDlg::execute (ObjectList& objects)
{
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow(getOperation())->
RemoveIntWires(myObject, myWiresInd);
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
GEOM::GEOM_Object_var anObj = anOper->RemoveIntWires(myObject, myWiresInd);
bool aResult = !anObj->_is_nil();
if (aResult)

View File

@ -278,10 +278,12 @@ bool RepairGUI_SewingDlg::isValid( QString& msg )
bool RepairGUI_SewingDlg::execute( ObjectList& objects )
{
bool aResult = false;
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() );
if ( IsPreview() ) { // called from onDetect(): detect free boundary edges, highlight them (add to objects), display message dialog
GEOM::ListOfGO_var aClosed, anOpen;
aResult = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->GetFreeBoundary( myObject, aClosed, anOpen );
aResult = anOper->GetFreeBoundary( myObject, aClosed, anOpen );
if ( aResult ) {
myClosed = aClosed->length();
@ -296,7 +298,7 @@ bool RepairGUI_SewingDlg::execute( ObjectList& objects )
myClosed = -1;
}
else {
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->Sew( myObject, myTolEdt->value() );
GEOM::GEOM_Object_var anObj = anOper->Sew( myObject, myTolEdt->value() );
aResult = !anObj->_is_nil();
if ( aResult )
{
@ -304,7 +306,7 @@ bool RepairGUI_SewingDlg::execute( ObjectList& objects )
{
QStringList aParameters;
aParameters << myTolEdt->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
}
objects.push_back( anObj._retn() );
}

View File

@ -621,8 +621,8 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects )
QStringList anErrorObjNames;
for ( int i = 0; i < myObjects->length(); i++ ) {
GEOM::GEOM_Object_var obj = myObjects[i];
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->
ProcessShape( obj, anOperators, aParams, aValues );
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() );
GEOM::GEOM_Object_var anObj = anOper->ProcessShape( obj, anOperators, aParams, aValues );
if ( anObj->_is_nil() )
anErrorObjNames << GEOMBase::GetName( obj );
else
@ -638,7 +638,7 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects )
aParameters << QString( aParams[i] );
aParameters << getTexts( aParams );
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
}
objects.push_back( anObj._retn() );
}

View File

@ -295,7 +295,8 @@ bool RepairGUI_SuppressFacesDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var obj = myObjects[i];
GEOM::short_array faces = myFaces[i];
//MESSAGE(">>>> Dlg, passing faces.. len = " << faces.length());
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->SuppressFaces( obj, faces );
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() );
GEOM::GEOM_Object_var anObj = anOper->SuppressFaces( obj, faces );
if ( anObj->_is_nil() )
anErrorObjNames << GEOMBase::GetName( obj );
else