Really strange segmentation fault
I get a really strange segmentation fault and I've got no idea why I keep getting it.
If I would strip down the code (and move everything from .cpp file to .h file) , all that would remain is
Code:
Q_OBJECT
public:
App(){}
void foo(){m_authenticated = false;}
private:
bool m_authenticated;
}
(it is too much code to post here so I hope this will be enough, else I will put the code on the net somewhere to download)
Now the problem is that the call to foo gives me a segmentation fault exactly when I try to access m_authenticated. I have no clue why. Do you? (I've tried the same thing with an int, and it fails. it also fails if it is declared public).
Any guesses or suggestions on how to debug?
Re: Really strange segmentation fault
When I ran the debugger and added a watch it said: not in scope (when I was inside of foo())!
Re: Really strange segmentation fault
Check that the object you call foo() upon is valid (i.e. esp not the 0-pointer).
Or: Your error is somewhere else; C/C++ has the nice property that you can overwrite any memory, including the stack, so the debugger's stack trace might be damaged, too.
(The information, meaning source, you provide, is not enough to track the error down.)
Re: Really strange segmentation fault
How do you call foo? You've pasted just the class definition.