Salome HOME
Bug 0020034: [CEA 282] crash in SALOME_Session_Server after SMESH computation.
[modules/smesh.git] / src / SMESH / SMESH_Octree.cxx
index 5b224ae5d8ff163c56c6b4a097cb6373e3f43bea..1b02db8dad3cde551dfc1fa5c8bb501531f6cf3a 100644 (file)
@@ -35,6 +35,7 @@
  */
 //===========================================================================
 SMESH_Octree::SMESH_Octree (const int maxLevel, const double minBoxSize):
+    myChildren(NULL),
     myFather(NULL),
     myLevel(0),
     myMaxLevel(maxLevel),
@@ -71,8 +72,9 @@ SMESH_Octree::~SMESH_Octree ()
 //===========================================================================
 void SMESH_Octree::setBox(const Bnd_B3d* box)
 {
-  delete myBox;
-  myBox=new Bnd_B3d(*box);
+//   delete myBox;
+//   myBox=new Bnd_B3d(*box);
+  *myBox = *box;
 }
 
 //===========================================================================
@@ -81,11 +83,12 @@ void SMESH_Octree::setBox(const Bnd_B3d* box)
  * \param box          - Set box to the 3d Bounding Box of the Octree
  */
 //===========================================================================
-void SMESH_Octree::getBox(Bnd_B3d* box)
+void SMESH_Octree::getBox(Bnd_B3d& box)
 {
-  if(box != NULL)
-    delete box;
-  box = new Bnd_B3d (*myBox);
+//   if(box != NULL)
+//     delete box;
+//   box = new Bnd_B3d (*myBox);
+  box = *myBox;
 }
 
 //===========================================================================
@@ -135,7 +138,7 @@ void SMESH_Octree::Compute()
 //=================================================================
 void SMESH_Octree::buildChildren()
 {
-  myChildren = new (SMESH_Octree*)[8];
+  myChildren = new SMESH_Octree*[8];
 
   gp_XYZ min = myBox->CornerMin();
   gp_XYZ max = myBox->CornerMax();