Run-time Assertion
I'm getting a "Debug Assertion Failed" error when I run my game. The dialogue box also says:
dbgdel.cpp
line 52
_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
Basically, I have code using delete to free up memory allocated. In the class's destructor that I allocated, I have just this line (line 52):
delete [] &animations
Here's what animations is:
cAnimation* animations[NUM_ENEMY_ANIMATIONS];
Any ideas of what the problem is? I put in message box code to help me find exactly where it crashed, and everything runs just fine before that line.
Only delete what you new. It doesn't look like you newed the animations variable, so you shouldn't try to delete it.
You have to use new to allocate the data. Like this:
Edit: and do what ace said also.
cAnimation* animations = new cAnimation[NUM_ENEMY_ANIMATIONS];
Edit: and do what ace said also.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement