]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Fix memory leaks
authorvsr <vsr@opencascade.com>
Mon, 21 Sep 2009 13:24:01 +0000 (13:24 +0000)
committervsr <vsr@opencascade.com>
Mon, 21 Sep 2009 13:24:01 +0000 (13:24 +0000)
src/GroupGUI/GroupGUI_GroupDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx

index 5e558035115cf30590e2139fe5e7c5b7aa9b7756..7fc1099f6757253c5bfddd31fecb1df7ccc813c3 100644 (file)
@@ -194,14 +194,14 @@ void GroupGUI_GroupDlg::Init()
 
         mainFrame()->ResultName->setText( GEOMBase::GetName( myGroup ) );
 
-        GEOM::GEOM_IGroupOperations_var anOp = GEOM::GEOM_IGroupOperations::_narrow( getOperation() );
-        myMainObj = anOp->GetMainShape( myGroup );
+        GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow( getOperation() );
+        myMainObj = anOper->GetMainShape( myGroup );
         if ( !CORBA::is_nil( myMainObj ) )
           myMainName->setText( GEOMBase::GetName( myMainObj ) );
 
-        setShapeType( (TopAbs_ShapeEnum)anOp->GetType( myGroup ) );
+        setShapeType( (TopAbs_ShapeEnum)anOper->GetType( myGroup ) );
 
-        GEOM::ListOfLong_var aCurrList = anOp->GetObjects( myGroup );
+        GEOM::ListOfLong_var aCurrList = anOper->GetObjects( myGroup );
         for ( int i = 0, n = aCurrList->length(); i < n; i++ )
           myIdList->addItem( new QListWidgetItem( QString( "%1" ).arg( aCurrList[i] ) ) );
 
@@ -1052,25 +1052,25 @@ bool GroupGUI_GroupDlg::execute( ObjectList& objects )
 {
   setInPlaceObj( GEOM::GEOM_Object::_nil() );
 
-  GEOM::GEOM_IGroupOperations_var anOp = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
+  GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
 
   GEOM::GEOM_Object_var aGroup;
   if (myMode == CreateGroup)
-    aGroup = anOp->CreateGroup(myMainObj, getShapeType());
+    aGroup = anOper->CreateGroup(myMainObj, getShapeType());
   else if (myMode == EditGroup)
     aGroup = myGroup;
 
-  if (CORBA::is_nil(aGroup) || (myMode == CreateGroup && !anOp->IsDone()))
+  if (CORBA::is_nil(aGroup) || (myMode == CreateGroup && !anOper->IsDone()))
     return false;
 
-  GEOM::ListOfLong_var aCurrList = anOp->GetObjects(aGroup);
-  if (!anOp->IsDone())
+  GEOM::ListOfLong_var aCurrList = anOper->GetObjects(aGroup);
+  if (!anOper->IsDone())
     return false;
 
   if (aCurrList->length() > 0)
   {
-    anOp->DifferenceIDs(aGroup, aCurrList);
-    if (!anOp->IsDone())
+    anOper->DifferenceIDs(aGroup, aCurrList);
+    if (!anOper->IsDone())
       return false;
   }
 
@@ -1082,8 +1082,8 @@ bool GroupGUI_GroupDlg::execute( ObjectList& objects )
     for (ii = 0; ii < nn; ii++) {
       aNewList[ii] = myIdList->item(ii)->text().toInt();
     }
-    anOp->UnionIDs(aGroup, aNewList);
-    if (!anOp->IsDone())
+    anOper->UnionIDs(aGroup, aNewList);
+    if (!anOper->IsDone())
       return false;
   }
 
@@ -1115,8 +1115,8 @@ GEOM::GEOM_Object_ptr GroupGUI_GroupDlg::getFather( GEOM::GEOM_Object_ptr theObj
 {
   GEOM::GEOM_Object_var aFatherObj;
   if ( theObj->GetType() == GEOM_GROUP ) {
-    GEOM::GEOM_IGroupOperations_var anOp = GEOM::GEOM_IGroupOperations::_narrow( getOperation() );
-    aFatherObj = anOp->GetMainShape( theObj );
+    GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow( getOperation() );
+    aFatherObj = anOper->GetMainShape( theObj );
   }
   return aFatherObj._retn();
 }
index ab47b76d39101dd0728d1667f4d7ce896713f1b0..00f0b3d99226aec4016864d1b39afa531c9bd530 100644 (file)
@@ -448,11 +448,13 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects)
 
   GEOM::GEOM_Object_var anObj;
 
+  GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
+  
   switch (getConstructorId()) {
   case 0:
     {
       if (!CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2)) {
-        anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxTwoPnt(myPoint1, myPoint2);
+        anObj = anOper->MakeBoxTwoPnt(myPoint1, myPoint2);
         res = true;
       }
     }
@@ -463,14 +465,14 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects)
       double y = GroupDimensions->SpinBox_DY->value();
       double z = GroupDimensions->SpinBox_DZ->value();
 
-      anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxDXDYDZ(x, y, z);
+      anObj = anOper->MakeBoxDXDYDZ(x, y, z);
       if (!anObj->_is_nil() && !IsPreview())
       {
        QStringList aParameters;
        aParameters << GroupDimensions->SpinBox_DX->text();
        aParameters << GroupDimensions->SpinBox_DY->text();
        aParameters << GroupDimensions->SpinBox_DZ->text();
-       anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+        anObj->SetParameters(aParameters.join(":").toLatin1().constData());
       }
       res = true;
     }
index 5bbe434789fbe33daf34fc6c7acbb6ae9cc8ee07..91807dfc66453f6821efd9e28533aa0fc6ef7c18 100644 (file)
@@ -470,32 +470,32 @@ bool PrimitiveGUI_ConeDlg::execute (ObjectList& objects)
 
   GEOM::GEOM_Object_var anObj;
 
+  GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
+
   switch (getConstructorId()) {
   case 0:
     if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
-      anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
-        MakeConePntVecR1R2H(myPoint, myDir, getRadius1(), getRadius2(), getHeight());
+      anObj = anOper->MakeConePntVecR1R2H(myPoint, myDir, getRadius1(), getRadius2(), getHeight());
       if (!anObj->_is_nil() && !IsPreview())
       {
        QStringList aParameters;
        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());
       }
       res = true;
     }
     break;
   case 1:
-    anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
-      MakeConeR1R2H(getRadius1(), getRadius2(), getHeight());
+    anObj = anOper->MakeConeR1R2H(getRadius1(), getRadius2(), getHeight());
     if (!anObj->_is_nil() && !IsPreview())
     {
       QStringList aParameters;
       aParameters << GroupDimensions->SpinBox_DX->text();
       aParameters << GroupDimensions->SpinBox_DY->text();
       aParameters << GroupDimensions->SpinBox_DZ->text();
-      anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
     }
     res = true;
     break;
index b77bd11a36ee62b7b0373fb1d973e232e02efe79..b7123270b51cb48907563196d9c49de315e5a6d1 100644 (file)
@@ -461,30 +461,30 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
 
   GEOM::GEOM_Object_var anObj;
 
+  GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
+
   switch (getConstructorId()) {
   case 0:
     if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
-      anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
-        MakeCylinderPntVecRH(myPoint, myDir, getRadius(), getHeight());
+      anObj = anOper->MakeCylinderPntVecRH(myPoint, myDir, getRadius(), getHeight());
       if (!anObj->_is_nil() && !IsPreview())
       {
        QStringList aParameters;
        aParameters << GroupPoints->SpinBox_DX->text();
        aParameters << GroupPoints->SpinBox_DY->text();
-       anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+        anObj->SetParameters(aParameters.join(":").toLatin1().constData());
       }
       res = true;
     }
     break;
   case 1:
-    anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
-      MakeCylinderRH(getRadius(), getHeight());
+    anObj = anOper->MakeCylinderRH(getRadius(), getHeight());
     if (!anObj->_is_nil() && !IsPreview())
     {
       QStringList aParameters;
       aParameters << GroupDimensions->SpinBox_DX->text();
       aParameters << GroupDimensions->SpinBox_DY->text();
-      anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
     }
     res = true;
     break;
index 9344092c872b93cb65eea459d0f955270ae068d2..ab40eb1bdab2f5243001332f181282763a39f296 100755 (executable)
@@ -572,30 +572,29 @@ bool PrimitiveGUI_DiskDlg::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())->
-      MakeDiskR(getRadius(), myOrientationType);
+    anObj = anOper->MakeDiskR(getRadius(), myOrientationType);
     if (!anObj->_is_nil() && !IsPreview())
     {
       aParameters << GroupDimensions->SpinBox_DX->text();
-      anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
     }
     res = true;
     break;
   case 1:
-    anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
-      MakeDiskPntVecR(myPoint, myDir, getRadius());
+    anObj = anOper->MakeDiskPntVecR(myPoint, myDir, getRadius());
     if (!anObj->_is_nil() && !IsPreview())
     {
       aParameters << GroupPntVecR->SpinBox_DX->text();
-      anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
     }
     res = true;
     break;
   case 2:
-    anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
-      MakeDiskThreePnt(myPoint1, myPoint2, myPoint3);
+    anObj = anOper->MakeDiskThreePnt(myPoint1, myPoint2, myPoint3);
     res = true;
     break;
   }
index 3f6d5fe6aa5c2c5b9f1bff44171d0bd418b8ae04..49d47717f6865641917f6b4a69b26b01c95390bd 100755 (executable)
@@ -492,31 +492,30 @@ bool PrimitiveGUI_FaceDlg::execute (ObjectList& objects)
   bool res = false;
   QStringList aParameters;
   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())->
-      MakeFaceHW(GroupDimensions->SpinBox_DX->value(),
-                 GroupDimensions->SpinBox_DY->value(), myOrientationType);
+    anObj = anOper->MakeFaceHW(GroupDimensions->SpinBox_DX->value(),
+                              GroupDimensions->SpinBox_DY->value(), myOrientationType);
     if (!anObj->_is_nil() && !IsPreview())
     {
       aParameters << GroupDimensions->SpinBox_DX->text();
       aParameters << GroupDimensions->SpinBox_DY->text();
-      anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
     }
     res = true;
     break;
   case 1:
-    if (GroupType->RadioButton1->isChecked())
-      anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
-        MakeFaceObjHW(myEdge, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value());
-    else if (GroupType->RadioButton2->isChecked())
-      anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
-        MakeFaceObjHW(myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value());
+    anObj = GroupType->RadioButton1->isChecked() ? 
+      anOper->MakeFaceObjHW(myEdge, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value()) : 
+      anOper->MakeFaceObjHW(myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value());
     if (!anObj->_is_nil() && !IsPreview())
     {
       aParameters << GroupPlane->SpinBox_DX->text();
       aParameters << GroupPlane->SpinBox_DY->text();
-      anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
     }
     res = true;
     break;
index 6fc293005d19334c908758395155505f43bb890a..70ad0500b274b2718394e47e0442fc814ce755ac 100644 (file)
@@ -396,16 +396,18 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects )
   
   GEOM::GEOM_Object_var anObj;
 
+  GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
+
   switch ( getConstructorId() ) {
   case 0 :
     {
       if ( !CORBA::is_nil( myPoint ) ) {
-       anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSpherePntR( myPoint, getRadius() );
+       anObj = anOper->MakeSpherePntR( myPoint, getRadius() );
        if (!anObj->_is_nil() && !IsPreview())
         {
          QStringList aParameters;
          aParameters << GroupPoints->SpinBox_DX->text();
-         anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+          anObj->SetParameters(aParameters.join(":").toLatin1().constData());
        }
        res = true;
       }
@@ -413,12 +415,12 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects )
     }
   case 1 :
     {
-      anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSphereR( getRadius() );
+      anObj = anOper->MakeSphereR( getRadius() );
       if (!anObj->_is_nil() && !IsPreview())
       {
        QStringList aParameters;
        aParameters << GroupDimensions->SpinBox_DX->text();
-       anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+        anObj->SetParameters(aParameters.join(":").toLatin1().constData());
       }
       res = true;
       break;
index a756fdf623340ec678f0037baf18f738883aab1f..849e5d1a9d0e007e32c544cca508f01bce8b8259 100644 (file)
@@ -457,30 +457,30 @@ bool PrimitiveGUI_TorusDlg::execute (ObjectList& objects)
 
   GEOM::GEOM_Object_var anObj;
 
+  GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
+
   switch (getConstructorId()) {
   case 0:
     if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
-      anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
-        MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2());
+      anObj = anOper->MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2());
       if (!anObj->_is_nil() && !IsPreview())
       {
        QStringList aParameters;
        aParameters << GroupPoints->SpinBox_DX->text();
        aParameters << GroupPoints->SpinBox_DY->text();
-       anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+        anObj->SetParameters(aParameters.join(":").toLatin1().constData());
       }
       res = true;
     }
     break;
   case 1:
-    anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
-      MakeTorusRR(getRadius1(), getRadius2());
+    anObj = anOper->MakeTorusRR(getRadius1(), getRadius2());
     if (!anObj->_is_nil() && !IsPreview())
     {
       QStringList aParameters;
       aParameters << GroupDimensions->SpinBox_DX->text();
       aParameters << GroupDimensions->SpinBox_DY->text();
-      anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
     }
     res = true;
     break;