Archived

This topic is now archived and is closed to further replies.

McZ

std::list crash my engine...

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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 ]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites