Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5233 in orxonox.OLD for trunk/src/lib/graphics


Ignore:
Timestamp:
Sep 24, 2005, 1:17:18 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: filled some other memory leaks with safer code

Location:
trunk/src/lib/graphics/spatial_separation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/spatial_separation/quadtree.cc

    r5219 r5233  
    8282{
    8383  // delete what has to be deleted here
    84   delete [] this->nodes;
    8584  if (this->materials != NULL)
    8685  {
     
    9089  }
    9190
     91  delete this->offset;
     92
    9293  delete this->rootNode;
    93   delete offset;
     94  //delete [] this->nodes;
    9495}
    9596
  • trunk/src/lib/graphics/spatial_separation/quadtree_node.cc

    r5232 r5233  
    128128QuadtreeNode::~QuadtreeNode ()
    129129{
    130   if( this->nodeA != NULL)
     130  if( this->nodeA)
    131131    delete this->nodeA;
    132   if( this->nodeB != NULL)
     132  if( this->nodeB)
    133133    delete this->nodeB;
    134   if( this->nodeC != NULL)
     134  if( this->nodeC)
    135135    delete this->nodeC;
    136   if( this->nodeD != NULL)
     136  if( this->nodeD)
    137137    delete this->nodeD;
     138
     139  if( this->nodes)
     140    delete [] this->nodes;
    138141
    139142  if( this->pTriangles)
     
    247250  lenD = listD->getSize();
    248251
    249   pTriA = new sTriangleExt*[listA->getSize()];
    250   pTriB = new sTriangleExt*[listB->getSize()];
    251   pTriC = new sTriangleExt*[listC->getSize()];
    252   pTriD = new sTriangleExt*[listD->getSize()];
     252  pTriA = new sTriangleExt*[lenA];
     253  pTriB = new sTriangleExt*[lenB];
     254  pTriC = new sTriangleExt*[lenC];
     255  pTriD = new sTriangleExt*[lenD];
    253256
    254257  counter = 0;
     
    315318  v.z = this->pDimension->getCenter().z + this->pDimension->getAxis() / 2.0f;
    316319  rA = new Rectangle(v, this->pDimension->getAxis() / 2.0f);
     320
    317321  v.z = this->pDimension->getCenter().z - this->pDimension->getAxis() / 2.0f;
    318322  rB = new Rectangle(v, this->pDimension->getAxis() / 2.0f);
     323
    319324  v.x = this->pDimension->getCenter().x - this->pDimension->getAxis() / 2.0f;
    320325  rC = new Rectangle(v, this->pDimension->getAxis() / 2.0f);
     326
    321327  v.z = this->pDimension->getCenter().z + this->pDimension->getAxis() / 2.0f;
    322328  rD = new Rectangle(v, this->pDimension->getAxis() / 2.0f);
     329
    323330
    324331  /* now create the new nodes  */
Note: See TracChangeset for help on using the changeset viewer.