• Advertisement
Sign in to follow this  

Wierd problem

This topic is 3575 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have this class and a private variable that is set in the constructor, and is never changed there-after. Later on in a class function it is used and is somehow incorrect, holding the wrong value. However, if I redefine it in the function itself it works correctly. and I've searched through the code with cntrl-f to make sure it is used nowhere else. Strangest thing I've encountered yet and no known solution, if it helps the variable is a private integer, but I dont see this causing a problem.

Share this post


Link to post
Share on other sites
Advertisement
It sounds like a bad pointer access, buffer overrun, inconsistent alignment or other similar problem. Did you try defining the variable as const to make sure nothing in your code actually does alter it? Or setting a data breakpoint on the value to see when something does change it?

Share this post


Link to post
Share on other sites
I don't see anything DirectX-specific about this, moved to 'For Beginners' - you may wish to dig up Richard 'superpig' Fine's article on debugging. It'll give you some more insight into solving this sort of problem and explain some of SiCrane's suggestions.

Cheers,
Jack

Share this post


Link to post
Share on other sites
Put a breakpoint in your constructor to make sure it's being called and used correctly.

Then put a hardware breakpoint for writes to the address of the variable. This should catch anything that is altering the value.

If it doesn't hit the breakpoint then chances are you are acessing the variable incorrectly in some way. Check your scope and such.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement