• ### What is your GameDev Story?

#### Archived

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

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

## Recommended Posts

I have a bit of a problem. My app doesn't works fine... until you try to turn it off. I get an access violation at the line below:
  WriteError("Destructing CMap Object"); if (Tileset) Tileset->Release(); // this is the problem WriteError("Released Tileset"); DeleteTiles(); WriteError("Done Destructing CMap Object"); 
It really has me stumped. Because of the WriteError() functions (as you can see), I was able to narrow the possible problem lines to the if statement and the conditional code. The debugger says it was the Tileset->Release() line that caused the access violation. It also says that Tileset is a valid address, and I tried a version of the code that did a Restore() on the surface before releasing it. Same problem. Any ideas? --Edit-- I think I may have figured it out myself, just now, but I am not going to delete this post in case I am wrong. I still want to hear your input. My new idea: the CMap object in question is a global... which means it is deallocated when the program quits, right? I should have realized this from the errorlog. It says "shutdown complete", then it says "Destructing CMap Object". I think it has something to do with DirectDraw being shut down before the surface is release.... now how do I fix it? Hopefully when I wake up in the morning, one of you brilliant programmers will have a solution for me (I don't mean to sound like I depend on all the Gamedev members for solving all my little problems, its just that you can apply brainpower from different time zones while I try to sleep ) Edited by - Yanroy on January 14, 2001 10:05:49 PM

##### Share on other sites
Simple: make sure that section of code is executed before everything else is shut down.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 14
• 10
• 9
• 11
• ### Forum Statistics

• Total Topics
634096
• Total Posts
3015493
×