I have a piece of code where I instantiate a c_mesh object, then add it to my vector, scn_meshes...
try
{
c_mesh add_mesh(scn_device,
pass_file,
pass_id);
scn_meshes.push_back(add_mesh);
}
catch(...)
{
throw;
}
There is an int property, msh_id that's set to pass_id when the constructor is called. Everything's fine right up to the point where the code returns from the push_back(). At that point the property msh_id is somehow corrupted. Instead of being set to pass_id, as it was when leaving push_back(), it's set to some seemingly random number. Everything else in the object is fine. No exceptions seem to be thrown, although I must admit that I don't know enough about vectors to know if it would or should be throwing an exception from push_back().
I know there isn't much information here, but any tips on where to look would be greatly appreciated. Here's the class definition...
class c_mesh
{
private:
LPDIRECT3DDEVICE9 msh_device;
string msh_file;
int msh_id;
DWORD msh_material_count;
vector<D3DMATERIAL9> msh_materials;
LPD3DXMESH msh_mesh;
vector<LPDIRECT3DTEXTURE9> msh_textures;
protected:
public:
c_mesh (LPDIRECT3DDEVICE9 pass_device,
string pass_file,
int pass_id);
c_mesh (const c_mesh& rhs);
~c_mesh (void);
c_mesh& operator= (const c_mesh& rhs);
void msh_draw (void);
inline int msh_get_id (void)
{
return msh_id;
};
inline c_mesh* msh_get_mesh (void)
{
return this;
};
};