Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5232 in orxonox.OLD for trunk/src/lib


Ignore:
Timestamp:
Sep 24, 2005, 12:37:39 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: solved a memory leak in the QuadtreeNode

Location:
trunk/src/lib
Files:
2 edited

Legend:

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

    r5215 r5232  
    3838{
    3939  /* save all important variables localy */
     40  this->numTriangles = numTriangles;
    4041  this->pTriangles = triangles;
    41   this->numTriangles = numTriangles;
     42  this->numVertices = numVertices;
    4243  this->pVertices = pVertices;
    43   this->numVertices = numVertices;
     44
    4445  this->quadtree = quadtree;
    4546  this->parent = parent;
     
    260261    ++counter;
    261262  }
     263  delete iterator;
     264
    262265  counter = 0;
    263266  iterator = listB->getIterator();
     
    269272    ++counter;
    270273  }
     274  delete iterator;
     275
    271276  counter = 0;
    272277  iterator = listC->getIterator();
     
    278283    ++counter;
    279284  }
     285  delete iterator;
     286
    280287  counter = 0;
    281288  iterator = listD->getIterator();
     
    287294    ++counter;
    288295  }
     296  delete iterator;
    289297
    290298  /* now do cleanup */
     
    293301  delete listC;
    294302  delete listD;
    295   delete iterator;
    296303
    297304
  • trunk/src/lib/math/curve.cc

    r5231 r5232  
    6464  if (dirCurve)
    6565    delete dirCurve;
    66 
    6766}
    6867
     
    203202
    204203  // rebuilding the Curve itself
    205   float k=0;
     204  float k = 0;
    206205  float n = nodeCount -1;
    207206  float binCoef = 1;
    208   while(tmpNode)
     207  while( tmpNode)
    209208    {
    210209      tmpNode->factor = binCoef;
    211       if (tmpNode =tmpNode->next)
     210      if( tmpNode = tmpNode->next)
    212211        {
    213           binCoef *=(n-k)/(k+1);
     212          binCoef *= (n-k) / (k+1);
    214213          ++k;
    215214        }
     
    217216
    218217  // rebuilding the Derivation curve
    219   if(this->derivation <= 1)
     218  if( this->derivation <= 1)
    220219    {
    221220      tmpNode = firstNode;
    222221      delete dirCurve;
    223222      dirCurve = new BezierCurve(1);
    224       while(tmpNode->next)
     223      while( tmpNode->next)
    225224        {
    226           Vector tmpVector = (tmpNode->next->position)- (tmpNode->position);
     225          Vector tmpVector = (tmpNode->next->position) - (tmpNode->position);
    227226          tmpVector.x*=(float)nodeCount;
    228227          tmpVector.y*=(float)nodeCount;
Note: See TracChangeset for help on using the changeset viewer.