We received crash dump from customer site. I see that in one of the structures o nstack __vfptr is NUL.
Does it always point to problematic condition (memeory overrun, deleting object twice...) or is there case where this pointer can be null.
Are you using memset() anywhere on instances of your classes?
I've seen this problem before and the cause was code like
class C : SomeClassWithVirtualFunctions { public: C() { memset( this, 0, sizeof ( C ) ) ; // BAD!! sets _vfptr to 0 too } }
cppcheck is neat
You may be seeing a partially destroyed object on the stack. The compiler may mark part of an object as destroyed by clearing the virtual function table pointer, so that it can correctly implement destructors of classes with "diamond" inheritance (multiple inheritance of classes that have a common, virtual base class) If the program crashes during the destruction of the object, you'll see the partially destroyed object in the dump.
Older MSVC compilers did not correctly implement destructors for classes with diamond inheritance. Any time you tried to destroy one, the program would crash. I'm not sure if this is still the case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With