Jump to content
  • Advertisement
Sign in to follow this  
Tukun

Why won't the DXdevice close?

This topic is 2606 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

It's probably a very simple problem, but I spent an hour looking for what's causing it and couldn't find it.

I've made a very simple game engine in C++ using DirectX.

The thing works fine at runtime, but the function (or rather destructor) that's called to clean the directx device causes an error.

What's going on?

The main
http://pastebin.com/ajfRZf8g

The header
http://pastebin.com/8FA54FFY

I use VC++2010 pro to compile the program. I get the error when I run with debugging only. Closing the window causes this error.

Share this post


Link to post
Share on other sites
Advertisement

You shouldn't be explicitly calling the destructor. It will get called automatically.


Just to clarify it,
It gets called outside the source code?

Is that second call what causes it to crash?

Share this post


Link to post
Share on other sites
It gets called when the variable goes out of scope, which in this case is when your main() function ends. So yes, it gets called a second time and tries to release memory you've already released, which crashes.

Share this post


Link to post
Share on other sites

It gets called when the variable goes out of scope, which in this case is when your main() function ends. So yes, it gets called a second time and tries to release memory you've already released, which crashes.


Thank you very much Mike. Kudos

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!