std::list crash my engine...

Started by
3 comments, last by McZ 20 years, 5 months ago
in my cRenderSystem class I have a list of shaders like this

class cRenderSystem {
...

 std::list< cShaderBase* > m_Shaders;

public:
...

 void RegisterShader( cShaderBase *shader );
};
so my problem is when the engine shutdown it crash becouse it try to clear the m_Shaders list if I do it myself like this m_Shader.clear() then it will crash the same way. when I debug it I got this message from the debug thing of one of the members in my Shader "CXX0030: Error: expression cannot be evaluated" I usally get this error when I try to use an unallocated class example: cMyClass *myClass; cout << " Value One: " << myClass->firstValue << endl; the shader has not been deleted becouse it hasn't logged it self in my .log -file as it do when it is destroyed from it's destructor. [edited by - McZ on October 23, 2003 1:30:50 PM]
Advertisement
Isn''t it std::list?
Dat is off da hizzle fo shizzle dizzle
well... std::list then

but it doesn''t solve my problem though
Considering that I''ve never heard of stl::list, and therefore have no clue about its implementation, don''t expect any help on that side. I expect that most forum readers are in a similar situation.

However, what I can tell you is that using pointers to unallocated memory is generally seen as a Bad ThingTM.

[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Hello McZ,

If I recall since all you have is a list of pointers a clear on the list should not call anything or even delete the pointers.
It just remove the internal list object that holds your pointers.
It your job to go though and delete the pointers.

So it should not carsh at what your doing.
Have you tried to step into the clear of the list?

If you had a list of actual object then on a call to clear() the list would call each destructor.

Lord Bart

This topic is closed to new replies.

Advertisement