Re: Debug Assertion Failed _BLOCK_TYPE_IS_VALID(pHead->nBlockUse

Pucca wrote:
Hi Chris, I inserted the _ASSERTE(_CrtCheckMemory()) in several places and debug step through them and nothing crashed. Does that mean I don't have a heap memory problem? The crash is not actually occuring at the vector.push_back(newUserData). I coded a copy constructor and a operator= overload for my class but it still crashing with "An unhandled win32 exception occurred in mmc.exe" which then only gives me the assembly code.

I'm calling the using: vector.push_back(*newUserData);
That is creating a problem becuase newUserData is a pointer to my class that's created using new. I add the * to it to de-reference it but the vector class indicates all my data member of that object can not be evaluated in the debugging mode. Anyway to work around this? Thank you.

You need:
vector<CUserContextData*> userDataObjects;

Remember to delete the entries though, or you could use:
vector<shared_ptr<CUserContextData> > userDataObjects;
which will mean that the objects are auto-deleted.