Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4797 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Jul 6, 2005, 1:54:16 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: whiped out a segfault, that is produced, when the Array::finalize() function is called multiple times

Location:
orxonox/trunk/src/lib/graphics/importer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/importer/array.h

    r4793 r4797  
    4141    inline unsigned int getCount()const { return this->entryCount; };
    4242    inline int getIndex(T* entry) const;
     43    inline bool isFinalized() { return this->finalized; }
    4344    void debug() const ;
    4445
  • orxonox/trunk/src/lib/graphics/importer/model.cc

    r4796 r4797  
    820820{
    821821  /* make sure, that all the arrays are finalized */
    822   this->vertices->finalizeArray();
    823   this->vTexture->finalizeArray();
     822  if( unlikely(!this->vertices->isFinalized()))
     823    this->vertices->finalizeArray();
     824  if( unlikely(!this->vTexture->isFinalized()))
     825    this->vTexture->finalizeArray();
    824826  if( normals->getCount() == 0) // vertices-Array must be built for this
    825827    this->buildVertexNormals();
    826   this->normals->finalizeArray();
     828  if( unlikely(!this->normals->isFinalized()))
     829    this->normals->finalizeArray();
    827830
    828831
     
    855858  }
    856859
     860  PRINTF(0)("***************************************GOT %i triangles\n", this->triangleCount);
     861
    857862  /* allocate memory for the new triangle structures */
    858   if( unlikely((this->triangles = new sTriangleExt[this->vertices->getCount()]) == 0));
     863  if( unlikely((this->triangles = new sTriangleExt[this->triangleCount]) == 0));
    859864  {
    860865    PRINTF(2)("Could not allocate memory for triangle list\n");
Note: See TracChangeset for help on using the changeset viewer.