Re: Crash in Virtual destructor
"Mahesh" <Mahesh@discussions.microsoft.com> wrote in message
news:9D1CBA85-562F-474C-9FE7-0163ACDAC0DE@microsoft.com
I am working on a MAPI provider and have implemented one of the MAPI
Interface IMAPIAdviseSink. I have implemented a virtual destructor in
the derived class (CCustomAdviseSink) to cleanup memory.
Note(If it matters): my code is built in VC6 and the destructor is
called by MSPST32.dll from the latest Outlook 2007 SP2.
Somehow, you reinterpet_cast a pointer to your derived class to an
interface pointer, or something like that. Bottom line is, you are
giving your client a bad vtable. The client calls (through a vtable
slot) what it thinks is a regular method on the interface, but instead
ends up calling the destructor (passing a bogus 'this' pointer, too -
the crashing assembly instruction attempts to dereference 'this').
Show declarations of your classes, as well as the code where you create
an instance of your object and provide it to the client.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925