Jump to content
  • Advertisement
Sign in to follow this  
savail

How to properly delete a LPDIRECT3DTEXTURE9 vector?

This topic is 2702 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey
I initialise my Texture in this way:
std::vector<LPDIRECT3DTEXTURE9> Texture;
When I'm deleting it like this:
for(int i = 0; i < Input::Obj().Texture.size(); i++)
Input::Obj().Texture->Release();
Input::Obj().Texture.clear();

Debugger gives me an error so how to delete it properly?

Share this post


Link to post
Share on other sites
Advertisement
What error do you get exactly?

Since you call Release() to every texture in your vector I dont think you need to call Clear()

Share this post


Link to post
Share on other sites
error like this, after closing my program:
Unhandled exception at 0x004015d3 in LF.exe: 0xC0000005: Access violation reading location 0xfeeefef6.
It happenes while debugging

Share this post


Link to post
Share on other sites
amm that was my fault... It seems I've been deleting one texture more than 1 time. It caused errors

Share this post


Link to post
Share on other sites

What error do you get exactly?

Since you call Release() to every texture in your vector I dont think you need to call Clear()


Since he does not explicitly say that its in the deconstructor, he might indeed need to clear the vector after use, as it may be intended to be re-used at some point. It certainly can't hurt.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!