In Visual Studio 2008 (C++) I have a class destructor (Let's call this class 'A') which deletes a pointer to a different class (Let's call this class 'B').
it looks like this:
A::~A()
{
delete B;
B = NULL;
}
My B class has a pointer to the instance of A that created it. In B's destructor, I delete everything in B, except for the pointer to the instance of A.
In my debug build, it works okay, but fails on my release build..
In the debug build, right after B is deleted but before B is reassigned to NULL, The value of the pointer to the instance of A is something weird like 0xdddddddd.. However in the Release build, it is still pointing to the instance of A.. In both cases the pointer to B is still valid and B is not destroyed. What is going on and how do I fix it?