Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 10 Oct 2008
Offline Last Active Oct 01 2012 06:49 PM

#4953382 Game Engine Problem with loading multiple textures- HELP!

Posted by on 27 June 2012 - 11:29 AM

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 Posted Image ) This way reallocating the vector will only move the pointers around, which won't destroy/affect the texture objects themselves.

#4907847 delete kills my operator=

Posted by 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.