I am getting the following error when I try to compile some code from a Third-party SDK.
*Description Resource Path Location Type
deleting object of
This warning is produced when the base class has virtual member functions but no virtual dtor. This is a bug. If you don't have the code, then there's nothing you can do other than making sure you're manually de-allocating any resources in your subclass. Like in a custom cleanup()
member function that you make sure to call manually before deleting the object.
Another option is to static_cast
it to the correct class. Note that dynamic_cast
(which incurs runtime overhead and requires RTTI) is not needed. The compiler can derive the type relationship just fine at compile time in this case.
Of course, if the object is deleted somewhere else that's not part of you code, then you're out of luck. In that case, make sure your subclass doesn't allocate anything. That way it's not possible to leak even when the destructor isn't being called.