Skip to main content
gamedev.net
🔒 Locked

MSVC Debug errors

Started by Rocket05 5 replies 400+ views
Original Post
Rocket05
Rocket05
im getting a bunch of debug errors, like: DAMAGE: after Normal Block (#0) at 0xsomeaddress _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) DAMAGE: after Free block (#0) at 0xsomeaddress pHead->nBlockUse == nBlockUse _pLastBlock == pHead _FirstBlock == pHead ... all of these, heh, one after another all from a single call to delete, of an object which is a valid pointer anybody gotten these before? know how to fix ''em?
"I never let schooling interfere with my education" - Mark Twain
Rocket05
Rocket05
i looked through my code, and i do something *like* that. instead of the void* and casting, i have derived classes. the classes, although are pointed to by their base classes, should be pointing to their an instance of their derived class. would casting these pointer''s and accessing data from a derived class specific variable cause these errors? like i said, the base pointers should be pointing to valid derived classes.
"I never let schooling interfere with my education" - Mark Twain
Wreakon
Wreakon
Well, probably not. If you are allocating a derived class, converting the pointer to it''s base and then converting that same pointer back to the same dervied class you should be ok. To make sure, I have tested the code .

class A {
int y;
};

class B : public A {
public:
int i;
};
void __fastcall TForm1::Button1Click(TObject *Sender)
{
B* pB = new B();
pB->i = 896;
B* pB2 = 0;

A* pA = (A*)pB;
pB2 = (B*)pA;
int xx = pB2->i;

//here xx == pB->i
}


-------
"Programming is like sex make one mistake, and you have to support it forever."
Homepage: http://students.washington.edu/andrey
-------Homepage: http://www.pclx.com
Rocket05
Rocket05
then what is cuasing these errors?!? its driving me nuts! lol
"I never let schooling interfere with my education" - Mark Twain
Laroche
Laroche
I got these errors from deleting a DirectX interface pointer, instead of just ->Release()ing it and NULLing it
Check out my music at: http://zed.cbc.ca/go.ZeD?user_id=41947&user=Laroche&page=content
Rocket05
Rocket05
how do the directx interfaces delete themselves by a call to Release()? is there a call to ''delete this'' in them? i thought that was a bad programming practice...
"I never let schooling interfere with my education" - Mark Twain

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.