The dreaded illegal operation

Started by
0 comments, last by Yanroy 23 years, 3 months ago
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
--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

Advertisement
Simple: make sure that section of code is executed before everything else is shut down.

This topic is closed to new replies.

Advertisement