Salome HOME
Fix memory leaks
authorvsr <vsr@opencascade.com>
Mon, 21 Sep 2009 13:12:51 +0000 (13:12 +0000)
committervsr <vsr@opencascade.com>
Mon, 21 Sep 2009 13:12:51 +0000 (13:12 +0000)
src/EntityGUI/EntityGUI_3DSketcherDlg.cxx
src/EntityGUI/EntityGUI_SketcherDlg.cxx
src/EntityGUI/EntityGUI_SubShapeDlg.cxx
src/OperationGUI/OperationGUI_ArchimedeDlg.cxx
src/OperationGUI/OperationGUI_ChamferDlg.cxx
src/OperationGUI/OperationGUI_Fillet1d2dDlg.cxx
src/OperationGUI/OperationGUI_FilletDlg.cxx
src/OperationGUI/OperationGUI_GetShapesOnShapeDlg.cxx
src/OperationGUI/OperationGUI_PartitionDlg.cxx

index 286953f6c9ef8ee68aea12a1aaff499e082e04fc..1152b7f3ec80a057999e3533c619fe51d016baea 100755 (executable)
@@ -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() );
index d2b0db3300b70efda7446e468ad3f89ae651b90f..0ffb8134427b6f1da680612fd4b2b76b9f2b539e 100644 (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() );
index 45e27d2e712569473437c2188f22ef17f360e07b..9dc4679bfc4f164a8f15f9a726ed1e29b2566ef6 100644 (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;
index 96840b012167322ae45df629ae42abf6055c7010..f1c646c576bd1029543cdf8d3b946193b99921e1 100644 (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() );
   }
index af89feddd4a931f2eaf9580910c50170708ef756..ba19442f07cef5c45bc0fd1a1ae6b67a5d51cc85 100644 (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());
   }
 
index 43671b1495f77dd1ce6e75c92cd98d8f2991f4b4..d3220fed89829a38281e420a0e100e5f3e183292 100644 (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());
index 84a2f3134cdff391ba2d223c87b060e45811de0f..e6986bf03276db0ee28619c5f6d599c607f90a48 100644 (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());
   }
 
index 70e011f7a34b229e2baa656384dfd8e7219bbf07..729e46f5825cc9ee48a25404e6df18b91ae21e39 100644 (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());
index 0b10ca3914ca74fe443b6043bceccfab5b682cb8..f79ede15e8415b635bc75947bbd334b5a47af86c 100644 (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;
   }