Run-time Assertion

Started by
4 comments, last by PoLiSh_Peta 18 years, 8 months ago
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.
There are two inevitabilities in life: death and failure.-PoLiSh
Advertisement
Make it:

delete [] animations;

I think.

ace
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:
cAnimation* animations = new cAnimation[NUM_ENEMY_ANIMATIONS];


Edit: and do what ace said also.
____________________________________________________________Programmers Resource Central
Oh and that, far too tired here.

ace
Gah, thanks, I don't know what I was thinking. I know better than to delete un-newed stuff.
There are two inevitabilities in life: death and failure.-PoLiSh

This topic is closed to new replies.

Advertisement