From what i see, your texture list is vector<cTexture>, so your textures are held by value. If you add a new one, you might reallocate the vector's buffer which will copy then destroy all your existing textures. I don't know how your cTexture class handles being copied, but it has a good chance to be the issue. You should insert the textures in the manager by pointer, by dynamically allocating them with new/delete (or something that wraps those, I won't get in the smart pointer topic here ) This way reallocating the vector will only move the pointers around, which won't destroy/affect the texture objects themselves.
Posted by BenMatlock
on 30 January 2012 - 07:52 PM
In your constructor, name = "" makes it point to memory that is NOT heap-allocated (with new). It points probably to static memory. And you should NEVER delete this memory. You should strdupnew your empty string too.