Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5231 in orxonox.OLD for trunk


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

orxonox/trunk: hunted a valgrind error msg in the curve class, restructured the code to delete only local variables not external

Location:
trunk/src/lib/math
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/math/curve.cc

    r5218 r5231  
    3838Curve::Curve()
    3939{
    40   nodeCount = 0;
    41   firstNode = new PathNode;
    42   currentNode = firstNode;
    43 
    44   firstNode->position = Vector (.0, .0, .0);
    45   firstNode->number = 0;
    46   firstNode->next = 0; // not sure if this really points to NULL!!
    47 }
     40  this->nodeCount = 0;
     41  this->localTime = 0;
     42  this->derivation = 0;
     43  this->dirCurve = NULL;
     44  this->firstNode = new PathNode();
     45  this->currentNode = firstNode;
     46
     47  this->firstNode->position = Vector (.0, .0, .0);
     48  this->firstNode->number = 0;
     49  this->firstNode->next = 0; // not sure if this really points to NULL!!
     50}
     51
     52
     53Curve::~Curve()
     54{
     55  PathNode* pn = this->firstNode;
     56  PathNode* unusedPN;
     57  while( pn != NULL)
     58  {
     59    unusedPN = pn;
     60    pn = pn->next;
     61    delete unusedPN;
     62  }
     63
     64  if (dirCurve)
     65    delete dirCurve;
     66
     67}
     68
    4869
    4970/**
     
    171192BezierCurve::~BezierCurve()
    172193{
    173   PathNode* tmpNode;
    174   currentNode = firstNode;
    175   while (tmpNode != 0)
    176     {
    177       tmpNode = currentNode;
    178       currentNode = currentNode->next;
    179       delete tmpNode;
    180     }
    181   if (dirCurve)
    182     delete dirCurve;
     194
    183195}
    184196
  • trunk/src/lib/math/curve.h

    r5225 r5231  
    3737 public:
    3838  Curve();
     39  virtual ~Curve();
    3940
    4041  void addNode(const Vector& newNode);
Note: See TracChangeset for help on using the changeset viewer.