CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Threaded View

  1. #1
    Join Date
    Mar 2011
    Posts
    144

    crash initializing size_t array

    Hi guys, I'm wondering why I get a crash when initializing the indices array below (bottom)-
    Code:
      struct TerrainGroupData
          {
             TerrainGroupData(){};
             TerrainGroupData(Ogre::Vector3 ** iVertices, unsigned long ** iIndices, size_t* iFaceNum, size_t* iVertNum)
    
             {
    
                vertices = iVertices;
    
                indices = iIndices;
    
                meshIndexCount = iFaceNum;
    
                meshVertexCount = iVertNum;
    
             }
             ~TerrainGroupData(){
                delete [] vertices;
                delete [] indices;
             };
             size_t *meshVertexCount;
             size_t *meshIndexCount;
    
             Ogre::Vector3 ** vertices;
    
             unsigned long ** indices;
    
          };
    ...
    // using the struct  in cpp file 
             terrainGroupData.indices = new unsigned long*[1];
             size_t size = 3;
    
             // resize this terrain's index buffer
             terrainGroupData.indices[0] = new unsigned long[size]; // crash here
    Last edited by drwbns; November 26th, 2012 at 04:42 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured