I’m analyzing an access violation in our application that occurs because it tries to call a virtual function on an object whose virtual function table points to 0. So I’d like to know at what points in an object’s lifetime is the virtual function table pointer not set or explicitly set to zero?
(We use Visual C++ 10 as a compiler.)
The vtable pointer will never be 0 while the object is in a valid state. During construction and destruction, while the object has a dynamic type of an abstract base class, the vtable will point to the abstract base class vtable, which will include pure virtual functions, but the vtable pointer itself will still be non-zero.
The only time the vtable pointer can be zero is before construction or after destruction.