From: vsr Date: Mon, 21 Sep 2009 13:01:41 +0000 (+0000) Subject: Fix memory leaks X-Git-Tag: V5_1_3rc1~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=47d4ddf2b2b10e524eb74e422c3aa99592a1d80d;p=modules%2Fgeom.git Fix memory leaks --- diff --git a/src/BuildGUI/BuildGUI_CompoundDlg.cxx b/src/BuildGUI/BuildGUI_CompoundDlg.cxx index 2a25fa2ac..a839123b1 100644 --- a/src/BuildGUI/BuildGUI_CompoundDlg.cxx +++ b/src/BuildGUI/BuildGUI_CompoundDlg.cxx @@ -230,9 +230,8 @@ bool BuildGUI_CompoundDlg::isValid( QString& ) //================================================================================= bool BuildGUI_CompoundDlg::execute( ObjectList& objects ) { - GEOM::GEOM_Object_var anObj; - - anObj = GEOM::GEOM_IShapesOperations::_narrow( getOperation() )->MakeCompound( myShapes ); + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() ); + GEOM::GEOM_Object_var anObj = anOper->MakeCompound( myShapes ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); diff --git a/src/BuildGUI/BuildGUI_EdgeDlg.cxx b/src/BuildGUI/BuildGUI_EdgeDlg.cxx index 1548635f4..ceee5f69a 100644 --- a/src/BuildGUI/BuildGUI_EdgeDlg.cxx +++ b/src/BuildGUI/BuildGUI_EdgeDlg.cxx @@ -293,9 +293,8 @@ bool BuildGUI_EdgeDlg::isValid (QString&) //================================================================================= bool BuildGUI_EdgeDlg::execute (ObjectList& objects) { - GEOM::GEOM_Object_var anObj; - - anObj = GEOM::GEOM_IShapesOperations::_narrow(getOperation())->MakeEdge(myPoint1, myPoint2); + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() ); + GEOM::GEOM_Object_var anObj = anOper->MakeEdge(myPoint1, myPoint2); if (!anObj->_is_nil()) objects.push_back(anObj._retn()); diff --git a/src/BuildGUI/BuildGUI_FaceDlg.cxx b/src/BuildGUI/BuildGUI_FaceDlg.cxx index e1adb30c6..c06a1fa15 100644 --- a/src/BuildGUI/BuildGUI_FaceDlg.cxx +++ b/src/BuildGUI/BuildGUI_FaceDlg.cxx @@ -245,11 +245,8 @@ bool BuildGUI_FaceDlg::isValid( QString& ) //================================================================================= bool BuildGUI_FaceDlg::execute( ObjectList& objects ) { - GEOM::GEOM_Object_var anObj; - - bool isPlanarWanted = GroupWire->CheckButton1->isChecked(); - anObj = GEOM::GEOM_IShapesOperations::_narrow( - getOperation() )->MakeFaceWires( myWires, isPlanarWanted ); + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() ); + GEOM::GEOM_Object_var anObj = anOper->MakeFaceWires( myWires, GroupWire->CheckButton1->isChecked() ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); diff --git a/src/BuildGUI/BuildGUI_ShellDlg.cxx b/src/BuildGUI/BuildGUI_ShellDlg.cxx index bd1cb125a..1e4b38a8f 100644 --- a/src/BuildGUI/BuildGUI_ShellDlg.cxx +++ b/src/BuildGUI/BuildGUI_ShellDlg.cxx @@ -259,10 +259,8 @@ bool BuildGUI_ShellDlg::isValid( QString& ) //================================================================================= bool BuildGUI_ShellDlg::execute( ObjectList& objects ) { - GEOM::GEOM_Object_var anObj; - - anObj = GEOM::GEOM_IShapesOperations::_narrow( - getOperation() )->MakeShell( myFacesAndShells ); + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() ); + GEOM::GEOM_Object_var anObj = anOper->MakeShell( myFacesAndShells ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); diff --git a/src/BuildGUI/BuildGUI_SolidDlg.cxx b/src/BuildGUI/BuildGUI_SolidDlg.cxx index 05b62c1a2..592fa436b 100644 --- a/src/BuildGUI/BuildGUI_SolidDlg.cxx +++ b/src/BuildGUI/BuildGUI_SolidDlg.cxx @@ -267,9 +267,7 @@ bool BuildGUI_SolidDlg::isClosed(int i) return false; } - GEOM::GEOM_IMeasureOperations_ptr anOp = myGeomGUI->GetGeomGen()->GetIMeasureOperations( getStudyId() ); - - // GEOM::GEOM_IMeasureOperations_var anOp = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() ); + GEOM::GEOM_IMeasureOperations_var anOp = myGeomGUI->GetGeomGen()->GetIMeasureOperations( getStudyId() ); // Detect kind of shape and parameters aKind = anOp->KindOfShape(aShape, anInts, aDbls); @@ -295,17 +293,17 @@ bool BuildGUI_SolidDlg::execute( ObjectList& objects ) { bool toCreateSingleSolid = GroupSolid->CheckButton1->isChecked(); + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() ); + if ( toCreateSingleSolid ) { - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow( - getOperation() )->MakeSolidShells( myShells ); + GEOM::GEOM_Object_var anObj = anOper->MakeSolidShells( myShells ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } else { for ( int i = 0, n = myShells.length(); i< n; i++ ) { - GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow( - getOperation() )->MakeSolidShell( myShells[ i ] ); + GEOM::GEOM_Object_var anObj = anOper->MakeSolidShell( myShells[ i ] ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); diff --git a/src/BuildGUI/BuildGUI_WireDlg.cxx b/src/BuildGUI/BuildGUI_WireDlg.cxx index 5acb5845e..58d24c027 100644 --- a/src/BuildGUI/BuildGUI_WireDlg.cxx +++ b/src/BuildGUI/BuildGUI_WireDlg.cxx @@ -252,10 +252,8 @@ bool BuildGUI_WireDlg::isValid (QString& msg) //================================================================================= bool BuildGUI_WireDlg::execute (ObjectList& objects) { - GEOM::GEOM_Object_var anObj; - - anObj = GEOM::GEOM_IShapesOperations::_narrow(getOperation())-> - MakeWire(myEdgesAndWires, GroupArgs->SpinBox_DX->value()); + GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() ); + GEOM::GEOM_Object_var anObj = anOper->MakeWire(myEdgesAndWires, GroupArgs->SpinBox_DX->value()); if (!anObj->_is_nil()) objects.push_back(anObj._retn());