I'm observing very strange behavior when I'm debugging my program. Everything is fine and dandy at breakpoint 1. At breakpoint 2, the memory at *watcher is corrupted and the program soon crashes
I have a function:
void Space::AddWatcher(Watcher *watcher)
{
int x = 4;
So, at breakpoint 1, my Watcher object appears to be fine. Watcher->id, and all its other variables, are what they should be.
Then, immediately after, at breakpoint 2, the Watcher object is corrupted. Watcher->id and etc is all out of whack.
While this program does usually launch other threads, I commented out all of the other threads to eliminate them as the culprit of this issue. Only the main thread is running.
Also, this only happens when I'm debugging the program (Visual Studio 2008). When I run it normally - no errors. When I debug it, I get this error consistently, every time.
I can also use the "Attach to process" debugging feature just fine... but if I launch it using "Start Debugging" I get the above behavior...
No ideas? For now I'm just ignoring it and moving on because I don't have a clue wtf is causing it, but I do feel like I'm avoiding something that's going to bite me in the butt later