So I was debugging a program that was showing a Segfault. I ran gdb and from the backtrace I see that the value of (this) changes on calling.
The calling function is of the type
Foo::funcName1() const {
return Bar::funcName2()->calledFunc();
}
The called function is of the form
Foo2::calledFunc() const {
/*
Some stuff
*/
}
According to the backtrace I have
0x00007ff456a9ec9f in Blah::Meh::funcName1() const (this=0x1f59b40)
0x00007ff44fee181c in Foo2::calledFunc() const (this=0x0)
How can this be happening ?